STUDENT

DATA HANDLING USING PANDAS AND DATA VISUALIZATION
Total Q: 82
Time: 70 Mins

Q 1.

Given the following Series S1 and S2:
Write the command to find the sum of series S1 and S2

Q 2.

What is the default index type for a Pandas Series if not explicitly specified?

Q 3.

A social science teacher wants to use a pandas series to teach about Indian historical monuments and its states. The series should have the monument names as values and state names as indexes which are stored in the given lists, as shown in the code. Choose the statement which will create the series:
import pandas as pd
Monument=['Qutub Minar','Gateway of India','Red Fort','Taj Mahal']
State=['Delhi','Maharashtra','Delhi','Uttar Pradesh']

Q 4.

Observe the following figure. Identify the coding for obtaining this as output.

Q 5.

The name "Pandas" is derived from the term:

Q 6.

Fill in the Blank:
When we create Dataframe from list of dictionaries, then number of columns in DataFrame is equal to the ____________ .

Q 7.

On the basis of the dataframe DF, which command will add a new column with name of student 'Prem' in the dataframe

Q 8.

Which Matplotlib plot is best suited to represent changes in data over time?

Q 9.

What is the minimum number of arguments required for plot() function in matplotlib?

Q 10.

While creating a Series using a dictionary, the keys of the dictionary become:

Q 11.

In Python Pandas, DataFrame._____[] is used for label indexing with DataFrames.

Q 12.

State whether the following statement is True or False:
In Python, we cannot create an empty DataFrame.

Q 13.

Assertion (A) : In order to be able to use Python's data visualization library, we need to import the pyplot module from matplot library.
Reason (R) : The pyplot module houses a variety of functions required to create and customize charts or graphs.

Q 14.

Which function will be used to read data from a CSV file into pandas data frame?

Q 15.

State whether the following statement is True or False:
The index of a DataFrame must be unique.

Q 16.

Which of the following Python statements can be used to select a column column_name from a DataFrame df ?

Q 17.

Which of the following libraries defines an ndarray in Python?

Q 18.

Which of the following command will not show first five rows from the Pandas series named S1 ?

Q 19.

In Python Pandas, head(n) method returns the first n members of the series. What is the default value of n ?

Q 20.

Which of the following command will show the last 3 rows from a Pandas Series named NP?

Q 21.

The following code creates a dataframe named 'df1' with ______________ columns.
import pandas as pd
ls1=[{'a':10, 'b':20, 'c':30, 'd':40},{'a':5, 'b':10, 'c':20}]
df1 = pd.DataFrame(ls1)

Q 22.

Which of the following import statement is not correct?

Q 23.

What is a correct syntax to return the values of first row of a Pandas DataFrame?
Assuming the name of the DataFrame is dfRent.

Q 24.

Assertion (A): The drop() method in Pandas can be used to delete rows and columns from a DataFrame.
Reason (R): The axis parameter in the drop() method specifies whether to delete rows (axis=0) or columns (axis=1).

Q 25.

State whether the following statement is True or False:
The column name of a DataFrame must be unique.

Q 26.

Write the output of the given command:
df1.loc[:0,'Sal']
Consider the given dataframe.

Q 27.

Which of the following Python statements is used to change a column label in a DataFrame, df?

Q 28.

While accessing the column from the data frame, we can specify the column name. In case column does not exist, which type of error it will raise:

Q 29.

State whether the following statement is True or False:
We can add a row in DataFrame using iloc.

Q 30.

To display last five rows of a series object 'S', you may write:

Q 31.

Which Python package is used for 2D graphics ?

Q 32.

State whether the following statement is True or False: The index of a Series must be unique.

Q 33.

Assertion (A): We can add a new column in an existing DataFrame.
Reason (R): DataFrames are size mutable.

Q 34.

Given a Pandas series called Sequences, the command which will display the first 4 rows is ______.

Q 35.

Which of the following Python statements will be used to select a specific element having index as points, from a Pandas Series named ser?

Q 36.

Write the output of the given program:
import pandas as pd
S1=pd.Series([5,6,7,8,10],index=['v','w','x','y','z'])
l=[2,6,1,4,6]
S2=pd.Series(l,index=['z','y','a','w','v'])
print(S1-S2)

Q 37.

The command to install the pandas is:

Q 38.

CSV stands for:

Q 39.

Pandas is a:

Q 40.

Which one of the following is an attribute of the series in Pandas to set the index label for the given object?

Q 41.

What will be the output of the Python program ?

import pandas as pd
I=['Apple','Banana','Mango','Orange','Litchi']
df=pd.DataFrame(I,index=[1,2,3,4,5])
print(df.iloc[1:3])

Q 42.

Out of the following, which function cannot be used for customization of charts in Python?

Q 43.

In Pandas library of Python, a one-dimensional array containing a sequence of values of any datatype is known as :

Q 44.

Which of the following statement will import pandas library?

Q 45.

Which of the following can be used to specify the data while creating a DataFrame?

Q 46.

In Python Pandas, while performing mathematical operations on series, index matching is implemented and all missing values are filled in with _____by default.

Q 47.

Assertion (A):- To use the Pandas library in a Python program, one must import it.
Reasoning (R): - The only alias name that can be used with the Pandas library is pd.

Q 48.

Fill in the Blank
Boolean indexing in Pandas DataFrame can be used for _______.

Q 49.

In a Pandas DataFrame, if the tail() function is used without specifying the optional argument indicating the number of rows to display, what is the default number of rows displayed, considering the DataFrame has 10 entries?

Q 50.

Method or function to add a new row in a data frame is:

Q 51.

Which of the following data structure is used for storing one-dimensional labelled data in Python Pandas?

Q 52.

State whether the following statement is True or False:
Slicing can be used to extract a specific portion from a Pandas Series.

Q 53.

By default, the plot() function of Matplotlib draws a ______ plot.

Q 54.

We can analyse the data in pandas with

Q 55.

Assertion (A) : A Series is a one dimensional array and a DataFrame is a two-dimensional array containing sequence of values of any data type. (int, float, list, string, etc.)
Reason (R) : Both Series and DataFrames have by default numenc indexes starting from zero.

Q 56.

Statement A: To make a Histogram with Matplotlib, we can use the plt.hist() function.
Statement B: The bin parameter is compulsory to create histogram.

Q 57.

What will be the output of the Python program mentioned below ?
import pandas as pd
df=pd.DataFrame(['Apple','Banana','Orange','Grapes','Guava'])
print(df[2:4:2])

Q 58.

On the basis of the dataframe DF, which command will delete the row of science marks?

Q 59.

Which of the following Python statements is used to import data from a CSV file into a Pandas DataFrame (Note: pd is an alias for pandas)?

Q 60.

Pandas Series is:

Q 61.

The command used to give a heading to a graph is _________

Q 62.

Assertion (A):- DataFrame has both a row and column index.
Reasoning (R): - A DataFrame is a two-dimensional labelled data structure like a table of MySQL.

Q 63.

What will be the output of the following Pythan code ?
import pandas as pd
dd={'Jan':31,'Feb':28,'Mar':31,'Apr':30}
rr=pd.Series(dd)
print(rr)

Q 64.

Python pandas was developed by:

Q 65.

Which of the following is NOT true with respect to CSV files?

Q 66.

Ritika is a new learner for the python pandas, and she is aware of some concepts of python. She has created some lists, but is unable to create the data frame from the same. Help her by identifying the statement which will create the data frame.
import pandas as pd
Name=['Manpreet','Kavil','Manu','Ria']
Phy=[70,60,76,89]
Chem=[30,70,50,65]

Q 67.

Using Python Matplotlib _________ can be used to count how many values fall into each interval

Q 68.

What will be the output of the following program ?
import pandas as pd
x=6
S1=pd.Series(x,index=[1,2,4,6,8,9])
print(S1)

Q 69.

Using Python Matplotlib __________ can be used to display information as a series of data points.

Q 70.

In Python which function of matplotlib library is used to save a plot?

Q 71.

_____________ is the function to save the graph.

Q 72.

Consider the following data frame name df
Write the output of the given command:
print(df.marks/2)

Q 73.

Fill in the Blank:
When we create Dataframe from dictionary of Series, then number of columns in DataFrame is equal to the ___________ .

Q 74.

What will be the output of the given code?
import pandas as pd
s = pd.Series([1,2,3,4,5], index=['akram','brijesh','charu','deepika','era'])
print(s['charu'])

Q 75.

Which command will be used to delete 3rd and 5th rows of the data frame. Assuming the data frame name as DF, with default indexes.

Q 76.

Assertion (A) : The Pandas library in Python is primarily used for creating static, animated and interactive 2D plots or figures.
Reason (R) : Data visualization can be achieved with the help of a variety of charts and plots, including static plots, animations, and interactive visualizations.

Q 77.

In a DataFrame, Axis= 1 represents the_____________ elements.

Q 78.

Assertion (A): In Dataframe, using rename function we can change the name of multiple columns using single statement.
Reason (R): In rename, axis=0 argument is mandatory for changing the column names.

Q 79.

Write the output of the given command:
import pandas as pd
s=pd.Series([1,2,3,4,5,6],index=['A','B','C','D','E','F'])
print(s[s%2==0])

Q 80.

Which of the following command is used to display first ten rows of a DataFrame 'DF' ?

Q 81.

Function to display the first n rows in the DataFrame:

Q 82.

What will be the output of the following Python code?
import pandas as pd
dd={ 'One' :1, 'Two' :2, 'Three' :3, 'Seven' :7}
rr=pd.Series(dd)
rr ['Four'] =4
print(rr)