Professional Documents
Culture Documents
*
Input -
import numpy as np
import pandas as pd
a1 = np.tile([5, 4], 3)
s1 = pd.Series(a1)
print(s1)
Output -
0 5
1 4
2 5
3 4
4 5
5 4
Input -
s2 = pd.Series({'XII A': 30, 'XII B': 40, 'XII C': 35})
print(s2)
Output -
Input -
s3 = pd.Series([5, 10, 15, 20], index = ["qtr1", "qtr2", "qtr3", "qtr4"])
print(s3)
Output -
Q. WAP to create a series containing the value as 200 medals recieved for the year
2020, 2021 and 2022.
Input -
s4 = pd.Series(200, index = [2020, 2021, 2022])
print(s4)
Output -
Q. WAP to create a series containing the value as 200 medals recieved for the years
2020 - 2030.
Input -
s5 = pd.Series(200, index = range(2020, 2031))
print(s5)
* Adding NaN (not a number) to a clause.
# you can fill the missing data with NaN value you can use the numpy module np. NaN
to specify the missing values.
Input -
s6 = pd.Series([2000, np.NaN, 3000])
print(s6)
Output -
0 2000
1 NaN
2 3000