WorksheetsData Frame and Series 3
Total questions: 20
Worksheet time: 10mins
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
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
Which of the functions can be used to delete column/row from a DataFrame?
pop()
at()
drop()
iloc()
Dataframe can contain multiple series
True
False
Which of the following statements are valid to create a empty series ?
s1=pd.Series(0)
s1=pd.Series()
s1=pd.Series(NaN)
s1=pd.Series(' ')
To get the number of bytes of the Series Data, ___________________ attribute is used.
index
size
itemsize
ndim
To get the number of dimensions of a Series object, ____________ attribute is displayed
itemsize
size
index
ndim
Sruti wants to create a Series with data 10, 20 , 30. She is confused from the choice given below:
s= pd.Series ( [ 10, 20, 30 ] )
s= pd.Series ( [ 10, 20, 30 ] , [ 0, 1, 2 ] )
s= pd.Series ( index= [ 0, 1, 2 ] , data = [ 10, 20, 30 ] )
All of the above
Write the output of the following?
import pandas as pd
s=pd.Series( [ 10,20,30,40,50] ,index=[1,2,3,4,5])
print ( s [ [ 1, 5, 3 ] ] )
Prints rows with index 1 , 5 and 3
Prints rows at position 1, 5 and 3
Prints rows with data 1,5, 3
Error
