STUDENT

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

Q 1.

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

Q 2.

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

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

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

Q 5.

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

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

Q 7.

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

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

Q 9.

In a DataFrame, Axis= 1 represents the_____________ elements.

Q 10.

The name "Pandas" is derived from the term:

Q 11.

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

Q 12.

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

Q 13.

Which of the following statement will import pandas library?

Q 14.

Which of the following import statement is not correct?

Q 15.

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

Q 16.

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

Q 17.

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

Q 18.

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

Q 19.

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

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

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

Q 22.

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

Q 23.

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

Q 24.

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

Q 25.

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

Q 26.

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

Q 27.

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

Q 28.

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

Q 29.

Function to display the first n rows in the DataFrame:

Q 30.

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

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

Q 32.

The command to install the pandas is:

Q 33.

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

Q 34.

CSV stands for:

Q 35.

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

Q 36.

Pandas Series is:

Q 37.

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

Q 38.

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

Q 39.

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

Q 40.

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

Q 41.

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

Q 42.

We can analyse the data in pandas with

Q 43.

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

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

Q 45.

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

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

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

Q 48.

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

Q 49.

_____________ is the function to save the graph.

Q 50.

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

Q 51.

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

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

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

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

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

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

Q 58.

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

Q 59.

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

Q 60.

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

Q 61.

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

Q 62.

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

Q 63.

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

Which of the following libraries defines an ndarray in Python?

Q 65.

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

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

Q 67.

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

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

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

Q 70.

Python pandas was developed by:

Q 71.

Pandas is a:

Q 72.

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

Which Python package is used for 2D graphics ?

Q 74.

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

Q 75.

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

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

Q 77.

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

Q 78.

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

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

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

Q 81.

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

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