CBSE Class 12 Informatics Practices
Question 160 of 167
Python Pandas — I — Question 14
Back to all questions 14
Question Write a program to create three different Series objects from the three columns of a DataFrame df.
import pandas as pd
df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'C': [7, 8, 9]})
s1 = df['A']
s2 = df['B']
s3 = df['C']
print(s1)
print(s2)
print(s3)0 1
1 2
2 3
Name: A, dtype: int64
0 4
1 5
2 6
Name: B, dtype: int64
0 7
1 8
2 9
Name: C, dtype: int64