Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to display the summary info of the DataFrame.
Data Analysis Python
df.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using describe() which shows statistics, not column types.
Using head() or tail() which show rows, not info.
✗ Incorrect
The info() method shows a summary of the DataFrame including column types.
2fill in blank
mediumComplete the code to print the data types of all columns in the DataFrame.
Data Analysis Python
print(df.[1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using df.columns which lists column names, not types.
Using df.shape which shows DataFrame size.
✗ Incorrect
The dtypes attribute shows the data type of each column.
3fill in blank
hardFix the error in the code to show DataFrame info with memory usage.
Data Analysis Python
df.info(memory_[1]=True)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect parameter names like memory_use or memory_show.
Forgetting the underscore between memory and usage.
✗ Incorrect
The correct parameter name is memory_usage to show memory details.
4fill in blank
hardFill both blanks to create a dictionary of column names and their data types.
Data Analysis Python
col_types = {col: df[col].[1] for col in df.[2] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using df.dtypes in the loop which returns a Series, not column names.
Using df.index which lists row labels, not columns.
✗ Incorrect
Use dtype to get a column's type and columns to loop over column names.
5fill in blank
hardFill all three blanks to filter columns with numeric data types using info() output.
Data Analysis Python
numeric_cols = [col for col in df.[1] if df.[2][col] in ['int64', [3]]]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'object' instead of 'float64' for numeric types.
Looping over df.dtypes which gives types, not column names.
✗ Incorrect
Loop over columns, check each column's dtypes, and include 'float64' as numeric type.