Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to show the summary info of the DataFrame.
Pandas
df.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using describe() instead of info()
Using head() or tail() which show rows, not info
✗ Incorrect
The info() method shows column types and null counts in a DataFrame.
2fill in blank
mediumComplete the code to import pandas with the common alias.
Pandas
import [1] as pd
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Importing numpy instead of pandas
Using wrong alias
✗ Incorrect
pandas is imported as pd by convention.
3fill in blank
hardFix the error in the code to show info of DataFrame named data.
Pandas
data.[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting parentheses after info
Using wrong case or brackets
✗ Incorrect
The info() method must be called with parentheses to execute.
4fill in blank
hardFill both blanks to create a DataFrame and show its info.
Pandas
import pandas as [1] df = [2].DataFrame({'A': [1, 2, None], 'B': ['x', 'y', 'z']}) df.info()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for import and DataFrame
Using numpy alias instead of pandas
✗ Incorrect
We import pandas as pd and use pd.DataFrame to create the DataFrame.
5fill in blank
hardFill all three blanks to create a DataFrame, add a column, and show info.
Pandas
import [1] as pd df = pd.DataFrame({'col1': [1, 2, 3]}) df['[2]'] = [4, 5, 6] df.[3]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong import alias
Forgetting quotes around new column name
Not calling info() as a method
✗ Incorrect
Import pandas as pd, add a new column named new_col, then call info() to see the summary.