Python Pandas Quiz (original) (raw)
Question: What is the purpose of the pivot_table() function in Pandas?
- To create a new DataFrame
- To pivot rows and columns in a DataFrame
- To perform statistical operations on a DataFrame
- To create a summary table
How can you handle missing values in a Pandas DataFrame?
- Use df.fillna(value) to replace missing values
- Use df.dropna() to remove rows with missing values
Question: How can you handle duplicate values in a Pandas DataFrame?
- Use the df.drop_duplicates() method
- Use the df.remove_duplicates() method
- Use the df.drop_duplicate_rows() method
- Use the df.eliminate_duplicates() method
What is the purpose of the melt() function in Pandas?
- To melt a DataFrame into a longer format
- To create a melted cheese plot
- To melt a DataFrame into a wider format
- To melt a DataFrame into a binary format
What does the nunique() method in Pandas calculate?
- The number of non-null values
- The number of unique values
- The number of distinct groups
- The number of unique rows
How can you perform a time-based resampling in Pandas?
- df.groupby("time_column").resample()
- df.time_groupby().resample()
How can you save a Pandas DataFrame to a CSV file?
- df.save_csv("filename.csv")
- df.write_csv("filename.csv")
- df.to_csv("filename.csv")
- df.export_csv("filename.csv")
Question: What does the nlargest() method in Pandas do?
- Returns the smallest values in a DataFrame
- Returns the largest values in a DataFrame
- Returns the smallest values in a column
- Returns the largest values in a column
How can you reset the index of a Pandas DataFrame?
What is the purpose of the pd.cut() function in Pandas?
- To cut a DataFrame into smaller pieces
- To categorize continuous data into discrete bins
- To remove duplicate values from a DataFrame
- To concatenate DataFrames along a particular axis
There are 25 questions to complete.
Take a part in the ongoing discussion