0% found this document useful (0 votes)
6 views1 page

Attributes of DataFrame

Uploaded by

Ankit Prasad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Attributes of DataFrame

Uploaded by

Ankit Prasad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Attributes of DataFrame

print(df.shape)
Ans : (4, 3)

print(df.size)
Ans : 12

print(df.index)
Ans : ['chennai', 'delhi', 'kolkata', 'mumbai']

print(df.columns)
Ans : ['population', 'hospitals', 'schools']

print(df.axes)
Ans : [Index(['chennai', 'delhi', 'kolkata', 'mumbai'], dtype='object'), Index(['population',
'hospitals', 'schools'], dtype='object')]

print(df.dtypes)
Ans : population int64
hospitals int64
schools int64
dtype: object

print(df.values)
Ans : [[ 4328063 157 7617]
[10927986 189 7916]
[ 4631392 149 7226]
[12691836 208 8508]]

print(df.ndim)
Ans : 2

print(df.T)
Ans : chennai delhi kolkata mumbai
population 4328063 10927986 4631392 12691836
hospitals 157 189 149 208
schools 7617 7916 7226 8508

print(df.empty)
Ans : False

You might also like