Font size
Worksheetspandas
Total questions: 118
Worksheet time: 1hrs 10mins
Which is not a feature of series
Homogeneous data
Immutable size
Mutable data
Multiple rows
Dataframe have
2D Array
Mutable size
Mutable data
All of above
Which package should be needed for series
Maths
Statistic
Pandas
Random
Full form of NaN is
Not a Null
Not a Number
Not a Numeric
None of these
Dataframe can be created using
Array
Dictionary
List
All of these
Full form of CSV file is
Comma Separated Vault
Comma Separated Value
Common Separated Value
Common System Value
Not a function of Dataframe
Head()
Tail()
loc()
multi()
which functions used to transfer data from dataframe to CSV files
to_data()
to_csv()
df_csv()
from_dataframe()
Dataframe can contain multiple series
True
False
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
In data science, which of the python library are more popular ?
numpy
pandas
django
none
Which is not a feature of series
Homogeneous data
Immutable size
Mutable data
Multiple rows
Series can be created from
Array
Dictionary
Scatter value
All of them
Which package should be needed for series
Maths
Statistic
Pandas
Random
Full form of NaN is
Not a Null
Not a Number
Not a Numeric
None of these
Data structures in Pandas can be mutated in the terms of ____ but not of _____.
size, value
value, size
semantic, size
none of the above
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
write the output:
import pandas as pd
s=pd.Series([1,2,3,4],index=['a','b','c','d'])
print(s.loc['b':'d'])
b 2
c 3
d 4
dtype: float64
b 2
c 3
d 4
dtype: object
c 3
d 4
dtype: int64
b 2
c 3
d 4
dtype: int64
Series is
A one dimensional structure
A two dimensional structure
A three dimensional structure
None of the Above
Data Frames is
One Dimensional
Two Dimensional
Three Dimensional
None of the above
Series is
Mutable
Immutable
Which is correct line to import pandas
import Pandas as pd
import panda as pd
import pandas as pd
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
s = pd.series(range(1,15,3),index = [x for x in 'abcde'])
print(s) gives ?
a 1
b 4
c 7
d 10
e 13
a 0
b 3
c 6
d 9
e 12
x 1
x 4
x 7
x 10
x 13
series = pd.series({'jan':31,"feb':29,'march':31})
print(series) gives ?
jan 31
feb 29
march 31
0 31
1 29
2 31
0 jan
1 feb
2 march
Data Frame contains ?
Data of same Types
Data of Different Types
s1 = pd.series([11,12,13,14])
s2 = pd.series([11,12,13,14],index=[1,2,3,4])
print(s1+s2) gives ?
0 22
1 24
2 26
3 28
0 11
1 12
2 13
3 14
0 11
1 12
2 13
3 14
Error
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 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
Which is not a feature of series
Homogeneous data
Immutable size
Mutable data
Multiple rows
Series can be created from
Array
Dictionary
Scatter value
All of them
Which package should be needed for series
Maths
Statistic
Pandas
Random
Full form of NaN is
Not a Null
Not a Number
Not a Numeric
None of these
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
write the output:
import pandas as pd
s=pd.Series([1,2,3,4],index=['a','b','c','d'])
print(s.loc['b':'d'])
b 2
c 3
d 4
dtype: float64
b 2
c 3
d 4
dtype: object
c 3
d 4
dtype: int64
b 2
c 3
d 4
dtype: int64
Pandas is_________.
a Python library that is built on NumPy and provides easy-to-use data structures and data analysis tools for the Python programming language.
a Python 2D plotting library which produces publication-quality figures in a variety of hardcopy formats and interactive environments across platforms.
a Python library that implements a range of machine learning,
preprocessing, cross-validation and visualization algorithms using a unified interface.
Give the output of the following code:
>>>import pandas as pd
>>>dict1 = {'AR' : 100, 'VR' : 200, 'AI' : 300}
>>>ser = pd.Series(dict1)
>>>print(ser[1])
AR
100
VR
200
print(ser[2,4])
print(ser[[2:4]])
print(ser[[2,4]])
print(ser[2,3,4])
Which of the following commands is used to install Pandas?
pip install python-pandas
pip install pandas
python install python
python install pandas
print(ser[[1,3]])
print(ser[1:3])
print(ser[[1:3]])
print(ser[1,3])
Have you enjoyed the quiz on Pandas Series?
Yes
No
Missing data in panda series and dataframe can be filled with a (a) value.
Basic feature of series are
Homogeneous data Size Immutable Values of Data Mutable
Hetrogenous data Size Immutable Values of Data Mutable
immutable size, immutable data
DataFrame is ______________
photo frame with data
module
like a two dimensional array with heterogeneous data
Which function from the options given below can read the dataset from a large text file?
read_json
read_pickle
read_hdf
read_csv
Which among the following options can be used to create a DataFrame in Pandas?
A scalar value
An ndarray
A python dict
All of the above
What does this line of code do?
Selects cols with vals > 1
Selects cols without NaN
Selects cols with any vals >1
Selects cols with NaN
What does this line of code do?
Drops NaN values
Replaces values with others
Fills NaN values with a predetermined value
_____ is a two-dimensional labelled data structure with columns of potentially different types, while_____ is a one-dimensional labelled array capable of holding any data type
Series, DataFrame
DataFrame, Series
____iterates over the DataFrame columns, returning a tuple with the column name and the content as a Series.
____returns a tuple with row index and row data as a Series object.
df.iteritems(), df.iterrows()
df.iterrows(), df.items()
What does this line of code do?
Returns unique values
Checks duplicates
Drops duplicates
Checks index duplicates
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
write the output:
import pandas as pd
s=pd.Series([1,2,3,4],index=['a','b','c','d'])
print(s.loc['b':'d'])
b 2
c 3
d 4
dtype: float64
b 2
c 3
d 4
dtype: object
c 3
d 4
dtype: int64
b 2
c 3
d 4
dtype: int64
To extract subset from Series,the following function is used
row()
column()
loc()
all
Predict the output:
obj2=pd.Series([3.5,5.,6.5,8.])
print(obj2.size,obj2.hasnans)
4 False
4 True
4 F
3 True
What will be the output of following code?
stu={'A':44,'B':44,'C':45,"D":47}
s8=pd.Series(stu)
print(s8[ :2]*100)
A 4400
B 4000
dtype: int64
A 4300
B 4000
dtype: int64
A 4300
B 3000
dtype: int64
A 3300
B 4000
dtype: int64
df['Tid'] & df.Tid are same
true
false
Full form of NaN is
Not a Null
Not a Number
Not a Numeric
None of these
Which of the following commands is used to convert array named "grades" into data frame named "df_grades"?
df_grades = grades
df_grades = pd.DataFrame(grades)
df_grades = pd.DataFrame("grades")
grades = pd.DataFrame(df_grades)
Type the syntax that returns the top 5 rows in DataFrame df with the native Pandas function (not slicing):
(a)
Which of the functions can be used to delete column/row from a DataFrame?
pop()
at()
iloc()
Which of the following statement/s will give 3 rows from bottom of the dataframe ?
Print(df.tail())
print(df.tail(3))
print(df.tail[3])
i) Which of the following statement will delete rank2 row from the dataframe ?
df.drop(‘rank2’)
df.drop(rank2)
delete df(rank2)
df.del(“rank2”)
The instructor wants to add a new column, Marks to the dataframe. The values of the marks will be 12, 22, 21, 24. Help him to choose the correct command to do so.
a) Df.columns=[12, 22, 21, 24]
b) df[‘marks’] = [12, 22, 21, 24]
c) df.loc[marks] = [12, 22, 21, 24]
d) Both (b) and (c) are correct
The axis=1 identifies a DataFrame's ____________
Rows
Values
Columns
Data Types
___________ attribute is used to specify column labels
column ()
column
columns()
columns
To get number of elements in a DataFrame _____ attribute may be used.
size
shape
values
ndim
To extract a row / column from a DataFrame ___ function may be used
row()
column()
loc()
All of the above
The insert function requires ____ number of arguments in DataFrame.
1
2
3
4
For the given DataFrame df, what will be the code to get the value 38?
df . iloc [1,1]
df . Age [222]
df . loc [111]
None of the above
