PythonFan.org
Toggle Menu
Home
Online Python Compiler
Tutorials
Python FastAPI
Python Pandas
Python PyTorch
Python Seaborn
Blog
All Posts
Data Handling With Pandas
Assess your knowledge of DataFrames,Series,and data cleaning.
1. Which Pandas object is a 2-dimensional labeled data structure with rows and columns?
Series
DataFrame
Panel
Array
2. Which methods are used to handle missing values by removing or replacing them?
dropna()
fillna()
isna()
notna()
3. The default axis for the `df.drop()` method is axis=0 (rows).
True
False
4. What is the Pandas function used to read a CSV file into a DataFrame? (enter the function name)
5. Which method returns the first 5 rows of a DataFrame by default?
head()
tail()
first()
top()
6. Which of the following are valid ways to select a single column as a Series from DataFrame `df`?
df['column_name']
df.column_name
df[['column_name']]
df.loc[:, 'column_name']
7. A Pandas Series can contain elements of multiple data types.
True
False
8. What does the `df.shape` attribute return?
A list of column names
A tuple (number of rows, number of columns)
The number of missing values
A summary of data types
9. What is the term for the unique row labels in a DataFrame? (single word)
10. Which aggregation functions can be used with `df.groupby('category')`?
sum()
mean()
group()
count()
11. The `df.fillna(0)` method modifies the original DataFrame by default.
True
False
12. Which function is used to check for missing values in a DataFrame?
dropna()
fillna()
isna()
unique()
13. What is the method used to combine two DataFrames vertically (stack rows) in Pandas? (function name)
14. Which operations can be performed using `df.loc[]`?
Select rows by label
Select columns by label
Select rows by position
Select columns by position
15. The `df.describe()` method provides summary statistics (count, mean, std, etc.) for numerical columns only.
True
False
16. What does `df.groupby('category')['value'].mean()` compute?
Total number of rows per category
Mean of 'value' for each 'category' group
Unique values in the 'category' column
Standard deviation of 'value' across all rows
17. Which of the following are valid ways to create a Pandas Series?
pd.Series([1, 2, 3])
pd.Series({'a': 1, 'b': 2})
pd.Series(5, index=[0, 1, 2])
pd.Series(df, column='col1')
18. The `inplace=True` parameter in `df.drop(columns=['col'], inplace=True)` modifies the original DataFrame.
True
False
19. Which method is used to rename columns in a DataFrame?
rename()
relabel()
change_columns()
set_columns()
20. What is the result of `df['column'].unique()`?
A count of each unique value
An array of unique values in the column
A sorted list of all values
The data type of the column
Reset
Answered 0 of 0 — 0 correct