STUDENT

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

Q 1.

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

Q 2.

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 3.

Which of the following libraries defines an ndarray in Python?

Q 4.

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)

Q 5.

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

Q 6.

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

Q 7.

Pandas is a:

Q 8.

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

Q 9.

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

Q 10.

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 11.

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

Q 12.

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

Q 13.

The command to install the pandas is:

Q 14.

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

Q 15.

CSV stands for:

Q 16.

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 17.

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

Q 18.

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

Q 19.

Which of the following statement will import pandas library?

Q 20.

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

Q 21.

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

Q 22.

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 23.

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 24.

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

Q 25.

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

Q 26.

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

Q 27.

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

Q 28.

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 29.

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 30.

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

Q 31.

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

Q 32.

In a DataFrame, Axis= 1 represents the_____________ elements.

Q 33.

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

Q 34.

Which Python package is used for 2D graphics ?

Q 35.

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 36.

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 37.

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

Q 38.

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 39.

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 40.

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

Q 41.

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 42.

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

Q 43.

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 44.

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

Q 45.

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

Q 46.

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 47.

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

Q 48.

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 49.

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

Q 50.

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

Q 51.

The name "Pandas" is derived from the term:

Q 52.

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

Q 53.

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

Q 54.

Pandas Series is:

Q 55.

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 56.

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 57.

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 58.

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

Q 59.

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

Q 60.

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

Q 61.

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

Q 62.

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 63.

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 64.

_____________ is the function to save the graph.

Q 65.

Function to display the first n rows in the DataFrame:

Q 66.

We can analyse the data in pandas with

Q 67.

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 68.

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

Q 69.

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

Q 70.

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

Q 71.

Python pandas was developed by:

Q 72.

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

Q 73.

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

Q 74.

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

Q 75.

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 76.

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

Q 77.

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

Q 78.

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

Q 79.

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 80.

Which of the following import statement is not correct?

Q 81.

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 82.

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