Practice sheet IP- Pandas, Matplotlib
0
Multiple Choice Questions (MCQs)
- Which command is used to install the Pandas library? a)
pip install numpy
b)pip install pandas
c)pip install matplotlib
d)pip install python
- What is a data structure? a) A collection of files b) A collection of data values and the operations that can be applied to that data c) A method for data visualization d) A Python library
- Which of the following is a one-dimensional array in Pandas? a) DataFrame b) Series c) List d) Dictionary
- How can you access elements in a Pandas Series? a) Using functions and methods b) Using keys and values c) Using indexing and slicing d) Using modules and packages
- What are the two types of indexes in a Pandas Series? a) Positional and labelled b) Numerical and textual c) Primary and secondary d) Static and dynamic
- Which of the following best describes a DataFrame? a) A one-dimensional array b) A two-dimensional labeled data structure c) A three-dimensional array d) A collection of strings
- Which method is used to load data from a CSV file into a DataFrame? a) read_table() b) read_csv() c) read_excel() d) read_json()
- What is the function of DataFrame.T? a) Transpose the DataFrame b) Merge two DataFrames c) Split the DataFrame d) Append data to the DataFrame
- What does the DataFrame.loc[] method do? a) Allows positional indexing of rows b) Allows label-based indexing of rows c) Merges two DataFrames d) Deletes rows from the DataFrame
- Which of the following is a basic mathematical operation that can be performed on a Series? a) Summation b) Integration c) Differentiation d) Division
- What happens when there are no matching indexes during alignment in Pandas? a) An error is raised b) NaN values are returned c) The operation is ignored d) The data is merged
- Which library is required for data visualization in Python? a) NumPy b) Pandas c) Matplotlib d) SciPy
- What does the plt.xlabel() function do in Matplotlib? a) Sets the title of the plot b) Sets the x-label of the plot c) Sets the y-label of the plot d) Displays the plot
- What does the plt.show() function do in Matplotlib? a) Builds the plot b) Displays the figure c) Sets the x-label d) Sets the y-label
- Which function is used to create a plot in Matplotlib? a) plt.figure() b) plt.plot() c) plt.graph() d) plt.chart()
- Which of the following functions can be used to change the structure of a DataFrame? a) pivot() and pivot_table() b) reshape() and resize() c) split() and merge() d) stack() and unstack()
- What is the primary purpose of descriptive statistics in Pandas? a) To create plots b) To summarize data c) To visualize data d) To sort data
- What are the two functions used to alter the index in a DataFrame? a) reset_index and set_index b) change_index and update_index c) modify_index and adjust_index d) clear_index and define_index
- Which libraries are required for facilitating import and export of data between Pandas and MySQL? a) pymysql and sqlalchemy b) mysql.connector and pandasql c) sqlite3 and sqlalchemy d) mysqlclient and pandasql
- What is the general format of plotting a DataFrame in Pandas? a) df.show(kind = ‘ ‘) b) df.plot(kind = ‘ ‘) c) df.graph(kind = ‘ ‘) d) df.chart(kind = ‘ ‘)
Fill in the Blanks
Word Bank for Fill in the Blanks
Series, Reshaping, plt.xlabel(), plt.show(), labels, DataFrame, pip install pandas, append(), Sorting, import matplotlib.pyplot as plt, Descriptive statistics, hindrance, read_csv, DataFrame, plt.ylabel(), DataFrame.T, NumPy, Pandas, and Matplotlib, Series, DataFrame, Label-based, Importing
- __________ is a one-dimensional array containing a sequence of values in Pandas.
- The process of changing the structure of the DataFrame is known as __________.
- In Matplotlib, __________ is used to set the x-label of the plot.
- The function __________ is used to display the figure in Matplotlib.
- The basic difference between Pandas Series and NumPy ndarray is that operations between Series automatically align the data based on __________.
- __________ is a two-dimensional labeled data structure like a spreadsheet.
- __________ is the command to install the Pandas library.
- The __________ method in Pandas is used to merge two DataFrames.
- __________ is used to arrange data in a specified order, either ascending or descending.
- To import the pyplot module from Matplotlib, we use the statement __________.
- __________ are used to quantitatively summarize the given data.
- Missing values are a __________ in data analysis and must be handled properly.
- The __________ function in Pandas is used to read data from a CSV file into a DataFrame.
- A __________ in Pandas can be thought of as a dictionary of lists/Series.
- The function used to set the y-label of a plot in Matplotlib is __________.
- The Pandas function __________ gives the transpose of a DataFrame.
- __________ are Python libraries for scientific and analytical use.
- Two main data structures in Pandas library are __________ and __________.
- __________ indexing of rows in DataFrames is done using DataFrame.loc[].
- The process of fetching data from a MySQL table to a Pandas DataFrame is called __________.
Short Answer Questions
- What is a DataFrame in Pandas?
- Describe two main data structures in the Pandas library.
- Explain the difference between positional index and labelled index in a Pandas Series.
- What are descriptive statistics and name two functions used for this purpose in Pandas.
- How can data be loaded into a DataFrame from a file on the disk?
- What does the DataFrame.loc[] method do?
- Explain the process of altering the index in a DataFrame.
- What is the purpose of the plt.show() function in Matplotlib?
- How can data be plotted directly from a DataFrame in Pandas?
- What are the two primary strategies for handling missing data in Pandas?
Long Answer Questions
- Explain the process of importing and exporting data between Pandas and MySQL, including the required libraries and steps.
- Describe the components of a plot in Matplotlib and the basic steps to create and display a plot using this library.
- Compare and contrast Pandas Series and NumPy ndarray, focusing on their differences and similarities.
- Discuss the importance of data structures in Pandas and how they enable efficient data manipulation and analysis.