WorksheetsPandas Library Questions
Total questions: 20
Worksheet time: 13mins
What is Pandas primarily used for in Python?
Machine Learning
Data Analysis and Manipulation
Web Development
Image Processing
How can you create a new column in a DataFrame in Pandas?
df['new_column'] = value
df.add('new_column', value)
df.new_column(value)
df.insert('new_column', value)
Which command is used to load a CSV file into Pandas?
pd.read_file('data.csv')
pd.load_csv('data.csv')
pd.read_csv('data.csv')
pd.import_csv('data.csv')
How can you display the first 5 rows of a Pandas DataFrame?
df.first()
df.head()
df.top(5)
df.rows(5)
Which method provides a summary of a DataFrame, including count, mean, and standard deviation?
df.summary()
df.describe()
df.info()
df.head()
How can you filter rows where the column ‘Sales’ is greater than 1000?
df.where(Sales > 1000)
df[df['Sales'] > 1000]
df.select(Sales > 1000)
df.query(Sales > 1000)
The function used to handle missing values in a DataFrame is (a)
What does df.groupby('Category').sum() do?
Splits the DataFrame into categories and adds all values for each category
Creates a bar chart
Deletes duplicate categories
Filters the DataFrame for unique values
HHow do you reset the index of a DataFrame in Pandas?
df.index_reset(inplace=True)
df.reindex()
df.index_reset()
df.reset_index()
Which method removes duplicate rows from a DataFrame?
df.remove_duplicates()
df.drop_duplicates()
df.clean_duplicates()
df.delete_duplicates()
Which command is used to display a plot in Matplotlib?
plt.draw()
plt.show()
plt.display()
plt.open()
What is the function of plt.xlabel() in Matplotlib?
Labels the X-axis
Labels the Y-axis
Creates a title
Sets the axis limits
Which function is used to create a bar chart in Matplotlib?
bar()
plot()
scatter()
hist()
How can you change the color of a line in a Matplotlib plot?
Using color='red' inside plt.plot()
Using linecolor='red'
Using set_color('red')
Using colorize='red'
Which function is used to create a scatter plot in Matplotlib?
plt.scatter()
plt.plot()
plt.bar()
plt.pie()
Which method is used to sort a DataFrame by a specific column in Pandas?
df.sort('column')
df.arrange('column')
df.order_by('column')
df.sort_values('column')
How do you add a title to a plot in Matplotlib?
plt.title('Title')
plt.add_title('Title')
plt.set_title('Title')
plt.name('Title')
Which function is used to create a histogram in Matplotlib?
plt.line()
plt.plot()
plt.bar()
plt.hist()
In Matplotlib, which function is used to add labels to the x-axis and y-axis?
plt.xlabel() and plt.ylabel()
Which function in Matplotlib is used to create a line plot?
