CBSE Class 12 Informatics Practices
Question 164 of 167
Python Pandas — I — Question 18
Back to all questions 18
Question Write a program to create a Dataframe that stores two columns, which store the Series objects of the previous two questions (12 and 13).
import pandas as pd
import numpy as np
data = np.array(['a', 'b', 'c', 'd', 'e', 'f', 'g'])
S1 = pd.Series(data)
arr = np.arange(1, 11)
S2 = pd.Series(arr * 5)
df = pd.DataFrame({'Characters': S1, 'Table of 5': S2})
print(df) Characters Table of 5
0 a 5
1 b 10
2 c 15
3 d 20
4 e 25
5 f 30
6 g 35
7 NaN 40
8 NaN 45
9 NaN 50