WorksheetsUnit1_Pandas&Visualization
Total questions: 21
Worksheet time: 12mins
Which of the following is the correct way to create a Pandas DataFrame from a CSV file?
df = pd.DataFrame.from_csv('data.csv')
df = pd.read_csv('data.csv')
df = pd.DataFrame.read_csv('data.csv')
df = pd.DataFrame.load_csv('data.csv')
Which method is used to access a specific column in a Pandas DataFrame?
df.loc[]
df.iloc[]
df.column_name
All of the above
How can you check the number of rows and columns in a DataFrame?
df.size()
df.shape
df.length()
df.info()
What is the difference between a Pandas DataFrame and Series?
A DataFrame is a 2-dimensional data structure, while a Series is 1-dimensional.
A DataFrame can store heterogeneous data types, while a Series can only store homogeneous data types.
A DataFrame has both row and column labels, while a Series only has row labels.
All of the above.
Which method is used to calculate the sum of values in a Pandas Series?
series.sum()
series.total()
series.add()
series.aggregate('sum')
Which library is commonly used for data visualization in Python?
NumPy
Matplotlib
Pandas
Scikit-learn
How can you create a line plot using Matplotlib?
plt.scatter()
plt.bar()
plt.plot()
plt.hist()
What does the parameter 'kind' represent in the Pandas DataFrame plot() method?
It specifies the color palette for the plot.
It determines the type of plot to be generated (e.g., line, bar, scatter).
It controls the size of the plot.
It sets the title of the plot.
How can you add a legend to a Matplotlib plot?
plt.add_legend()
plt.legend()
plt.show_legend()
plt.set_legend()
Which method is used to save a Matplotlib plot as an image file?
plt.save_image()
plt.save_plot()
plt.savefig()
plt.export_image()
How can you select multiple columns from a Pandas DataFrame?
df.select_columns()
df.columns[]
df.get_columns()
df.loc[]
Which method is used to find unique values in a column of a Pandas DataFrame?
df.unique()
df.get_unique()
df.distinct()
df.values()
What is the purpose of the method df.describe() in Pandas?
It provides a summary of descriptive statistics for numerical columns in the DataFrame.
It generates a correlation matrix for all columns in the DataFrame.
It displays the first few rows of the DataFrame.
It checks for missing values in the DataFrame
How can you add a new column to an existing Pandas DataFrame?
df.add_column()
df.append_column()
df.insert_column()
df['new_column'] = values
Which method is used to drop a column from a Pandas DataFrame?
df.drop()
df.remove_column()
df.drop_column()
df.drop(['column_name'], axis=1)
What does the parameter 'kind' represent in the Pandas DataFrame plot() method?
It specifies the color palette for the plot.
It determines the type of plot to be generated (e.g., line, bar, scatter).
It controls the size of the plot
It sets the title of the plot.
Which method is used to create a bar plot using Pandas DataFrame?
df.line_plot()
df.scatter_plot()
df.bar()
df.plot(kind='bar')
How can you set the x-axis and y-axis labels in a Matplotlib plot?
plt.xlabel() and plt.ylabel()
plt.x_label() and plt.y_label()
plt.set_xlabel() and plt.set_ylabel()
plt.set_x_label() and plt.set_y_label()
How can you change the figure size of a Matplotlib plot?
plt.figure_size()
plt.resize()
plt.set_size()
plt.figure(figsize=(width, height))
What is the purpose of the method df.isnull() in Pandas?
It checks if any value in the DataFrame is missing.
It replaces missing values with a specified value.
It drops rows with missing values from the DataFrame.
It fills missing values with the mean of the column.
How can you change the color of a line plot in Matplotlib?
plt.color()
plt.set_color()
plt.line_color()
plt.plot(..., color='color_name')
