WorksheetsCT QUIZ 2
Total questions: 75
Worksheet time: 42mins
Best way to import the pandas module in your program ?
1.import pandas
2.import pandas as pd
3.from pandas import *
4.All of the above
Which is true for series.
Size is mutable,Values is mutable
size is immutable,values is mutable
size is mutable,values is immutable.
none
Series.tail(3) will return how many values.
3 values from front
3 values from last
5 values
none
Series.head() will return how many rows.
2
3
4
5
To extract subset from Series,the following function is used
row()
column()
loc()
all
we can analyze the data in pandas with :
Series
Dataframe
Both
none
Series in Pandas is
1 Dimensional Array
2 Dimensional array
3 Dimensional array
none of above
Minimum number of argument we require to pass in pandas series ?
0
1
2
3
Series can be created from
Array
Dictionary
Scatter value
All of them
Full form of NaN is
Not a Null
Not a Number
Not a Numeric
None of these
pandas is a:
Data Structure
Series
Dataframe
Library
Write the output for the following:
import pandas as pd1
s = pd1.Series(5, index=[0, 1, 2, 3])
print(s)
0 5
0 5
1 5
2 5
3 5
dtype: int64
1 5
2 5
2 5
4 5
dtype: int64
0 5
1 5
2 5
3 5
dtype: object
write the output:
import pandas as pd1
s = pd1.Series([1,2,3])
t = pd1.Series([1,2,4])
u=s-t
print (u)
0 1
1 0
2 1
dtype: int64
0 0
1 0
2 1
dtype: int64
0 0
1 0
2 -1
dtype: float64
0 0
1 0
2 -1
dtype: int64
write the output:
import pandas as pd
s=pd.Series([1,2,3,4],index=['a','b','c','d'])
print(s.iloc[2:4])
b 2
c 3
d 4
dtype: int64
b 3
c 4
dtype: int64
c 3
d 4
dtype: int64
none of the above
DataFrame is .......................
size mutable, data mutable
size immutable, data mutable
An empty DataFrame can be created by.................
passing arguments
without passing arguments
Which of the functions can be used to delete column/row from a DataFrame?
pop()
at()
drop()
iloc()
Full form of CSV file is
Comma Separated Vault
Comma Separated Value
Common Separated Value
Common System Value
Dataframe can contain multiple series
True
False
Which is the correct Pandas syntax to read in a csv file and assign it to a DataFrame df?
df = read_csv('file.csv')
df = read('file.csv', type = 'csv')
df = pd.read_csv('file.csv')
df = with open('file.csv') as pd.DataFrame
Which of the following is used to load an excel file to python environment?
pd.read_csv('fileName.csv')
pd.read_csv('fileName.xls')
pd.read_excel('fileName.xls')
None of the mentioned
Which among the following is present in NumPy?
List
Series
Dataframes
None of these
matplotlib library is built over
NumPy
Pandas
Seaborn
None of the mentioned
The keyword used to check the dimension of an array is
ndim
dim
dimension
ndimension
Which among the following is present in Pandas?
Series
Dataframes
None of the mentioned
Both the mentioned
The keyword used to find the null values is
isna()
isnull()
Both the mentioned
None of the mentioned
The common notation used for Pandas is
ns
pd
np
sns
The common notation used for matplotlib.pyplot is
plt
mat
np
sns
The common notation used for seaborn is
ns
pd
np
sns
Data Frames is
One Dimensional
Two Dimensional
Three Dimensional
None of the above
s = pd.series([1,2,3,4,5],index=['a','b','c','d','e'])
print(s[:3] gives ?
a 1
b 2
c 3
a 1
b 2
c 3
d 4
a 3
b 4
c 5
series = pd.series(55)
print(series) gives ?
0 51
1 52
2 53
3 54
4 55
1 51
2 52
3 53
4 54
5 55
0 55
1 55
2 55
3 55
4 55
Which of the functions can be used to delete column/row from a DataFrame?
pop()
at()
drop()
iloc()
Which function can be used to combine dataframes based on common fields?
merge()
combine_first()
concat()
For the concat(), if the axis=1, it will join the dataframes ...............
vertically
horizontally
Among the following functions, which one can be used to combine dataframes when they have similar structure.
combine_first
concat()
merge()
Series.tail(3) will return how many values.
3 values from front
3 values from last
5 values
none
Series.head() will return how many rows.
2
3
4
5
To extract subset from Series,the following function is used
row()
column()
loc()
all
Full form of NaN is
Not a Null
Not a Number
Not a Numeric
None of these
What is Matplotlib used for?
Data Analysis
Data Visualization
Machine Learning
Web Development
Which command is used to install Matplotlib?
pip install numpy
pip install pandas
pip install matplotlib
pip install seaborn
What does plt.show() do in Matplotlib?
Saves the plot
Displays the plot
Clears the plot
Closes the plot
Which module is primarily used to create plots in Matplotlib?
pyplot
graph
chart
plotlib
What is the default style of a Matplotlib plot?
Grid
Line
Histogram
Bar
How can you change the figure size in Matplotlib?
plt.figure(figsize=(width, height))
plt.size(width, height)
plt.plot_size(width, height)
plt.change_size(width, height)
Which function is used to create a bar chart in Matplotlib?
Which argument is used to change the color of a line plot?
color
line_color
c
set_color
Which function is used to create a scatter plot in Matplotlib?
What does plt.xlabel() do?
Sets the title
Sets the x-axis label
Sets the y-axis label
Sets the legend
What is the default style of Seaborn plots?
whitegrid
darkgrid
ggplot
classic
Which function is used to create a box plot in Seaborn?
sns.boxplot()
sns.barplot()
sns.histplot()
sns.pairplot()
What is a heatmap used for?
To visualize correlation
To compare categories
To show trends
To create bar plots
Which function is used to create a histogram in Seaborn?
sns.histplot()
sns.scatterplot()
sns.lineplot()
sns.heatmap()
Which function in Seaborn is used for pairwise relationships?
sns.boxplot()
sns.pairplot()
sns.histplot()
sns.violinplot()
Which function is used to set the style of Seaborn plots?
What does the hue argument do in Seaborn plots?
Sets the color of all elements
Groups data by a category
Changes the font size
Adjusts the figure size
What is the main advantage of Seaborn over Matplotlib?
Faster execution
More statistical plotting functions
Less memory usage
Direct integration with Excel
How we can find the type of numpy array in python?
dtype
typei
type
itype
Shape() function in Numpy array is used to
None of the Mentioned
Change the shape of the array
Assigns the desired shape to the array
Find the shape of the array
what is the use of the zeros() function in Numpy array in python ?
To make a Matrix with first row 0
To make a Matrix with all element 0
To make a Matrix with all diagonal element 0
None of the above
Which of the following is not valid to import the numpy module ?
import numpy as np
import numpy as n
import numpy as p
None of the above
What is the use of the size attribute in Numpy array in python ?
It find the direction
It find the shape
It finds the number of items
All of the above
Which of the following find the maximum number in the Numpy array?
max(array)
array.max()
array(max)
None of the above
x=np.array([10,20,30,40,50,60,70])
print(np.median(x))
Find the output
35
35.0
40
37.7
How to use numpy ?
import numpy as np
import pandas as pd
import pyplot as plt
import math as np
Name the function used to create an array?
np.aray()
np.array()
Np.array()
np.arange()
names = np.array(["Reem" , "Salah" , "Haya" , "Maryam" , "Fatema"])
print(names([2,3,4]))
Mark the right output from the below options
[ 'Haya' 'Maryam' 'Fatema' ]
[ 'Maryam' 'Haya' 'Fatema' ]
[ 'Reem' 'Salah' 'Fatema' ]
[ 'Reem' 'Salah' 'Haya' ]
Each location of an element in an array is called ______________
Size
Length
Index
Element
import numpy as np
a = np.array([[0, 1, 2], [3, 4, 5]])
b = a.sum(axis=1)
print (b)
3
12
[3 12]
[3 5 7]
__________ is a library used to create data structures and carry out scientific calculations.
Python
Numpy
Pycharm
Bar chart
Full form of CSV file is ...................
Comma Separated Vault
Comma Separated Value
Common Separated Value
Common System Value
Which is the correct Pandas syntax to read in a csv file and assign it to a DataFrame df?
df = read_csv('file.csv')
df = read('file.csv', type = 'csv')
df = pd.read_csv('file.csv')
df = with open('file.csv') as pd.DataFrame
Which of the following object you get after reading CSV file?
DataFrame
Character Vector
Panel
All of the mentioned
Which among these are correct , regarding csv files?
A common format for data interchange
Standard way to represent binary data.
It can be opened in spreadsheet packages like MS-Excel, Calc etc
There is no distinction between text and numeric values.
