DataFrames - PANDAS DataFrames Flashcards

1
Q

A Pandas DataFrame is a 2 dimensional data structure, like a 2 dimensional array, or a table with rows and columns.

A

Pandas DataFrames

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Locate Row - DataFrame is like a table with rows and columns.

A

Locate Row

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Locate Row - Pandas use the loc attribute to return one or more specified row(s)

A

Locate Row

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

DataFrame - When using [], the result is a Pandas DataFrame.

A

DataFrame

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Named Indexes - With the index argument, you can name your own indexes.

A

Named Indexes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Locate Named Indexes - Use the named index in the loc attribute to return the specified row(s).

A

Locate Named Indexes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Load Files Into a DataFrame -
If your data sets are stored in a file, Pandas can load them into a DataFrame.

A

Load Files Into a DataFrame

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Exercise - True or False. A DataFrame is like a table with rows and columns.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Exercise - Insert the correct Pandas method to create a DataFrame.

A

pd.DataFrame(data)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Exercise - Insert the correct syntax to return the first row of a DataFrame.

A

df.loc[0]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Exercise - Insert the correct syntax for loading CSV files into a DataFrame.

A

df.read_csv(data)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Exercise - Consider the following Code:
data = {
‘calories’: [420, 380, 390],
‘duration’: [50, 40, 45]
}
df = pd.DataFrame(data)
print(df.loc[0]) What type will the printed result have?

A

A Pandas Series

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Exercise - Insert the correct syntax for loading JSON files into a DataFrame.

A

df.read_json
(data)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Exercise - Insert the correct syntax for loading a Python dictionary called “data” into a DataFrame.

A

pd.DataFrame(data)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Exercise - Insert the correct syntax for returning the headers and the first 10 rows of a DataFrame.

A

df.head(10)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Exercise - When using the head() method, how many rows are returned if you do not specify the number?

A

The headers and 5 rows