Anjeev Singh Academy

Python Pandas Assignment – 1 Important Question Answer

Python Pandas (Series) Important Questions Answer

Exam Special Python Pandas Assignment


Que 1. What is the significance of Pandas library?

Answer: Pandas is a python module that makes data science or data analysis easy and effective. This is the famous python package for data science that offers powerful and flexible data structures which make data analysis and manipulation easy. Pandas make data importing and data analyzing easier.

Que 2. Name the three well-established Python libraries for scientific and analytical use.

Answer: NumPy, Pandas, and Matplotlib

Que 3. NumPy, Pandas, and Matplotlib libraries allow us to _____, ______, and ______ data easily and efficiently.

Answer: manipulate, transform, and visualise

Que 4. NumPy stands for _______.

Answer: Numerical Python

Que 5. What is NumPy?

Answer: Numerical Python is a package that can
be used for numerical data analysis and scientific computing.

  • NumPy uses a multidimensional array object and has functions and tools for working with these arrays.
  • Elements of an array stay together in memory, hence, they can be quickly accessed.

Que 6. PANDAS stands for _______.

Answer: PANel DAta System

Que 7. What is PANDAS ?

Answer: PANDAS is a high-level data manipulation
tool used for analysing data.

  • It is very easy to import and export data using the Pandas library which has a very rich set of functions.
  • It is built on packages like NumPy and Matplotlib and gives us a single, convenient place to do most of our data analysis and visualisation work.
  • Pandas have three important data structures, namely – Series, DataFrame, and Panel to make the process of analysing data organised, effective, and efficient.

Que 8. Name the important data structures of Python’s Pandas library.

Answer: Series, Dataframes and Panel

Que 9. Which library in Python is used for plotting graphs and visualization?

Answer: Matplotlib

Que 10. What is Matplotlib?

Answer: The Matplotlib library in Python is used for plotting graphs and visualisation.

  • Using Matplotlib, with just a few lines of code we can generate publication-quality plots, histograms, bar charts, scatterplots, etc.
  • It is also built on Numpy, and is designed to work well with Numpy and Pandas.

Que 11. Differentiate between Pandas and NumPy?

Answer: Differences between Pandas and Numpy are:

  1. A Numpy array requires homogeneous data, while a Pandas DataFrame can have different data types (float, int, string, datetime, etc.).
  2. Pandas have a simpler interface for operations like file loading, plotting, selection, joining, GROUP
    BY, which come very handy in data-processing applications.
  3. Pandas DataFrames (with column names) make it very easy to keep track of data.
  4. Pandas are used when data is in Tabular Format, whereas Numpy is used for numeric array-based
    data manipulation.

Que 12. Write the python command to install pandas.

Answer: pip install pandas

Que 14. What is data structure? Write commonly used data structures in pandas.

Answer: A data structure is a collection of data values and operations that can be applied to that data.
It enables efficient storage, retrieval, and modification of the data.

Two commonly used data structures in Pandas are:
• Series
• DataFrame

Que 15. What is Series?

Answer: Series is a one-dimensional array containing a sequence of values of any data type like int, float, list, string, etc, which by default have numeric data labels starting from zero.

  • The data label associated with a particular value is called its index.
  • We can also assign values of other data types as index.
  • Pandas Series as a column in a spreadsheet.

Que 16. How is a Series object different from and similar to ndarrays? Give some examples.

Answer: NumPy arrays or ndarrays are also similar to Series objects. But there are some differences:

  • NumPy allows vectorized operation between two same shape ndarrays while In Series object allows vectorized operation between two different shape objects. In this case, NaN is returned for non-matching indexes.
  • In ndarrays, indexes are always positive, starting from 0 while In Series objects can have any type of index, including numbers, letters, and labels. Strings, etc. In the case of numbers, starting with zero is unnecessary.

Que 17. Write the command to import a Pandas library.

Answer: import pandas
OR
import pandas as pd # importing pandas with alias pd

Que 18. Which Pandas method is used to create a Series object?

Answer: Series() method.

Que 19. Which types of data can be used while creating a Series object in Pandas?

Answer: (a) Python Sequence – List, Tuples, String
(b) Python Dictionary
(c) NumPy array – ndarray
(d) A scalar value

Example:

Que 20. Write a command to create a Series object from a list of values.

Answer: A series can be created by using a list of numbers as:

import pandas as pd                #import Pandas with alias pd
series1 = pd.Series([10,20,30])   #create a Series
print(series1)                   #Display the series

Output:

Sorry! You cannot copy content of this page. Please contact, in case you want this content.

Scroll to Top