0
0
Data Analysis Pythondata~10 mins

info() for column types in Data Analysis Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Ainfo
Bdescribe
Chead
Dtail
Attempts:
3 left
💡 Hint
Common Mistakes
Using describe() which shows statistics, not column types.
Using head() or tail() which show rows, not info.
2fill in blank
medium

Complete 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'
Acolumns
Bdtypes
Cshape
Dindex
Attempts:
3 left
💡 Hint
Common Mistakes
Using df.columns which lists column names, not types.
Using df.shape which shows DataFrame size.
3fill in blank
hard

Fix 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'
Ause
Bdisplay
Cshow
Dusage
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect parameter names like memory_use or memory_show.
Forgetting the underscore between memory and usage.
4fill in blank
hard

Fill 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'
Adtype
Bcolumns
Cdtypes
Dindex
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.
5fill in blank
hard

Fill 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'
Acolumns
Bdtypes
C'float64'
D'object'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'object' instead of 'float64' for numeric types.
Looping over df.dtypes which gives types, not column names.