NEW
Font size
WorksheetsSERIES IN PANDAS
Total questions: 15
Worksheet time: 30mins
Series.tail(3) will return how many values.
3 values from front
3 values from last
5 values
none
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
Let us suppose ser is a series. What will be the print statement to display last 3 elements?
print(ser.head(3))
print(ser.tail(3))
print(ser.head())
print(ser.tail())
Minimum number of argument we require to pass in pandas series ?
0
1
2
3
Series.head() will return how many rows.
2
3
4
5
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 check if the Series object contains NAN values, _____________ attribute is displayed.
hasnans
nbytes
ndim
dtype
To get the number of bytes of the Series Data, ___________________ attribute is used.
index
size
itemsize
ndim
What will be the index of the following series?
import pandas as pd
import numpy as np
info = {'x' : 0., 'y' : 1., 'z' : 2.}
a = pd.Series(info)
print (a)
0 1 2
1 2 3
x y z
None of the above
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
If S is a series object , which command should be used to change the name of the Series object?
S.index.name
S.name
S.index
S.columns
1. Given the following Series A1 and A2: 1
A1 A2
a 20 a 70
b 10 b 30
c 24 c 84
d 70 d 80
Write the command to find the sum of series A1 and A2
A1+A2
sum(A1,A2)
a1+a2
