Data Frame
1. It is a data structure.
2. It is a 2D data structure.
3. It is hetrogeneous.
4. It is value mutable.
5. It is also size mutable.
Syntax to create a Data Frame:
import pandas as pd
dataframe_object=pd.DataFrame(a 2D data structure,[columns=<column_sequence>],[index=<index Sequence>])
How to create DataFrame
1. Using 2D Dictionary
2. Using 2D ndarray
3. Using Series Object
4. Using another DataFrame Object
#DataFrame using 2D Dictionary
import pandas as pd
dic={'Students':['Ram','Raj','Sam','John'],'Marks':[40,20,35,28]}
D=pd.DataFrame(dic)
print(D)
import pandas as pd
dict1={'Section':['A','B','C','D'],'Contri':[6700,5600,5000,5200]}
D=pd.DataFrame(dict1)
print(D)
No comments:
Post a Comment