What does the info() method show about a DataFrame's columns?
The info() method shows the number of non-null values, the data type of each column, and the memory usage of the DataFrame.
Click to reveal answer
beginner
How can info() help you understand missing data in your dataset?
By showing the count of non-null values per column, info() helps identify columns with missing data because the count will be less than the total rows.
Click to reveal answer
beginner
What are some common data types you might see in the output of info()?
Common data types include int64 for integers, float64 for decimals, object for text or mixed types, and bool for True/False values.
Click to reveal answer
intermediate
Why is it useful to check the memory usage shown by info()?
Checking memory usage helps you understand how much RAM your DataFrame uses, which is important for working efficiently with large datasets.
Click to reveal answer
beginner
How do you call info() on a DataFrame named df?
You call it by typing df.info(). This will print the summary of the DataFrame's columns, types, and memory.
Click to reveal answer
What does df.info() NOT show?
AStatistical summary like mean or median
BData types of columns
CMemory usage of the DataFrame
DNumber of non-null values per column
✗ Incorrect
info() does not show statistics like mean or median; it shows data types, non-null counts, and memory usage.
If a column has fewer non-null values than total rows, what does it mean?
AThe column has no missing values
BThe column is numeric
CThe column has missing values
DThe column is categorical
✗ Incorrect
Fewer non-null values than total rows means some data is missing in that column.
Which data type in info() output usually represents text data?
Aint64
Bfloat64
Cbool
Dobject
✗ Incorrect
The object type usually means text or mixed types in pandas.
How do you get more detailed memory usage info from info()?
AUse <code>df.describe()</code>
BUse <code>df.info(memory_usage='deep')</code>
CUse <code>df.head()</code>
DUse <code>df.memory()</code>
✗ Incorrect
Passing memory_usage='deep' to info() gives a more accurate memory usage.
What is the main purpose of using info() on a DataFrame?
ATo get a quick overview of data types and missing values
BTo plot graphs
CTo sort the data
DTo change column names
✗ Incorrect
info() is used to quickly see data types, non-null counts, and memory usage.
Explain how the info() method helps you understand the structure of a DataFrame.
Think about what you want to know before analyzing data.
You got /4 concepts.
Describe how you can identify missing data in a DataFrame using info().
Missing data means some entries are empty or null.
You got /3 concepts.
Practice
(1/5)
1. What does the DataFrame.info() method primarily show about a dataset?
easy
A. The data types of each column and non-null counts
B. The first 5 rows of the dataset
C. The summary statistics like mean and median
D. The unique values in each column
Solution
Step 1: Understand the purpose of info()
The info() method is used to display concise summary of a DataFrame including data types and non-null counts.
Step 2: Compare with other methods
Methods like head() show rows, describe() shows statistics, and unique() shows unique values, so they are not correct here.
Final Answer:
The data types of each column and non-null counts -> Option A
Quick Check:
info() = data types + counts [OK]
Hint: Remember: info() shows types and counts, not data preview [OK]
Common Mistakes:
Confusing info() with head()
Thinking info() shows statistics
Assuming info() lists unique values
2. Which of the following is the correct way to call the info() method on a DataFrame named df?
easy
A. info(df)
B. df.info[]
C. df.info
D. df.info()
Solution
Step 1: Recall method call syntax in Python
Methods are called with parentheses after the method name, so df.info() is correct.
Step 2: Check other options
info(df) is incorrect because info is not a standalone function; df.info misses parentheses and returns the method object; df.info[] is invalid syntax.
Final Answer:
df.info() -> Option D
Quick Check:
Method call needs parentheses [OK]
Hint: Call methods with () after the name [OK]
Common Mistakes:
Forgetting parentheses when calling methods
Using info() as a standalone function
Using brackets [] instead of parentheses ()
3. Given the following DataFrame df and its info() output, what is the data type of the column Age?
The info output shows Age has 3 non-null values and data type int64.
Step 2: Match the data type to options
Among the options, int64 matches the data type shown for Age.
Final Answer:
int64 -> Option C
Quick Check:
Age column type = int64 [OK]
Hint: Look for column name and dtype in info() output [OK]
Common Mistakes:
Confusing object with string
Mixing float64 and int64 types
Ignoring the dtype column in info()
4. You run df.info() but get an error: AttributeError: 'list' object has no attribute 'info'. What is the most likely cause?
medium
A. You forgot to import pandas
B. You called info() on a list, not a DataFrame
C. You used info() without parentheses
D. The DataFrame is empty
Solution
Step 1: Analyze the error message
The error says a 'list' object has no attribute 'info', meaning the variable is a list, not a DataFrame.
Step 2: Identify the cause
Only DataFrames have the info() method. Calling it on a list causes this error.
Final Answer:
You called info() on a list, not a DataFrame -> Option B
Quick Check:
info() needs DataFrame, not list [OK]
Hint: Check variable type before calling info() [OK]
Common Mistakes:
Assuming info() works on lists
Ignoring error message details
Thinking empty DataFrame causes this error
5. You have a DataFrame df with 200 columns. Column 'B' has some missing values. You want to quickly check which columns have missing data and their data types. Which code snippet using info() helps you do this?
hard
A. df.info(verbose=True)
B. df.info(null_counts=True)
C. df.info(show_missing=True)
D. df.info()
Solution
Step 1: Recall info() behavior on wide DataFrames
With 200 columns (> pandas default max_info_columns=100), df.info() truncates the column list, hiding non-null counts and dtypes for most columns including potentially 'B'.
Step 2: Check options
df.info(verbose=True) forces full display of all columns' non-null counts and dtypes. Other parameters like null_counts and show_missing are invalid.
Final Answer:
df.info(verbose=True) -> Option A
Quick Check:
verbose=True for full column info on large DFs [OK]
Hint: df.info(verbose=True) for full missing counts/types on wide DFs [OK]
Common Mistakes:
Using df.info() on wide DFs (truncates columns)
Using invalid parameters with info()
Confusing verbose with missing data display
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.