Page 196 - Robotics and AI class 10
P. 196
Neha 91
Sonali 92
Shashi 96
dtype: int64
Attributes of the Series
Attributes Description Example
name A name to a series is given import pandas as pd
import numpy as np
data = np.array([10,30,50])
s1 = pd.Series(data)
s1.name="Rollno"
print(s1)
0 10
1 30
2 50
Name: Rollno, dtype: int64
index.name A name to an index is given s1.index.name="Students"
Students
0 10
1 30
2 50
Name: Rollno, dtype: int64
value Returns the list of values in the series print(s1.values)
[10 30 50]
size Returns the number of value in the series print(s1.size)
3
empty Returns True if the series is empty. print(s1.empty)
False
Built in Functions in Series
Function Description Example
head(n) Returns the first n members of the series. import pandas as pd
If n not specified then by default first friends =
five members are displayed. pd.Series(["Rohan","Susan","James",
"Riya","Sumit","Abhinav","Vihaan"]
index[11,22,33,44,55,66,77])
print(friends.head(2)}
11 Rohan
22 Susan
dtype: object
194 Touchpad Robotics & Artificial Intelligence-X

