Q. Write a program to create three different Series objects from the three rows of a DataFrame df.
You can understand by Watching video :-
Answer =
import pandas as pd d={"col1":[1,4,3],"\ col2":[6,7,8],'\ col3':[9,0,1]} df = pd.DataFrame(d) s = pd.Series(data=df.iloc[0]) s1 = pd.Series(data=df.iloc[1]) s2 = pd.Series(data=df.iloc[2])
Output :-
col1 1
col2 6
col3 9
Name: 0, dtype: int64
col1 4
col2 7
col3 0
Name: 1, dtype: int64
col1 3
col2 8
col3 1
Name: 2, dtype: int64
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )