Header Ads Widget

Responsive Advertisement

Class 12 Code 065 Data Frame Attributes


Attributes are the properties of a DataFrame that can be used to fetch data or any information related to a particular dataframe. The syntax of writing an attribute is: 

DataFrame_name.attribute 

These are the attributes of the dataframe: 

  • index 
  • columns 
  • axes 
  • dtypes 
  • size 
  • shape 
  • ndim 
  • empty 
  • values
All Important attribute of DataFrame 

import pandas as pd

s1=pd.DataFrame({"A":{"aa":12,"bb":13,"cc":14},"B":{"aa":12,"bb":13,"cc":14},"C":{"aa":12,"bb":13,"cc":14}})

#print(s1)

print("axis:",s1.axes)

print("Index:",s1.index)

print("Values:",s1.values)

print("Shape:",s1.shape)

print("Size",s1.size)

print("Dimension:",s1.ndim)

print("count:",s1.count())

print("count:",s1.count(0))

print("count:",s1.count(1))

print("Transpose:",s1.T)







Post a Comment

0 Comments