63. Pandas DataFrame Head(), Tail(), at() & iat() Functions in Python || Multi-index DataFrames

preview_player
Показать описание
Code:
import pandas as pd
student_dict={'Name':['Kumbhakaran','Indrajeet','Meghnath','Sugreev','Bali','Jatayu','Jambvaan'],
'Age':[20,21,19,17,18,19,17],
'Marks':[85.10,77.80,91,87,90,94,91]}
student_df=pd.DataFrame(student_dict)
print(topRows)
print(topRows)

('Standard 2','Class A'),('Standard 2','Class B'),
('Standard 3','Class A'),('Standard 3','Class B')],
name=['Standard','Class'])

student_df=pd.DataFrame([('Kumbhakaran',67),('Indrajeet',80),('Meghnath',75),
('Sugreev',87),('Bali',90),('Jatayu',94)],
index=index,columns=columns)
print(topRows)

# DataFrame Tail

student_dict={'Name':['Kumbhakaran','Indrajeet','Meghnath','Sugreev','Bali','Jatayu','Jambvaan'],
'Age':[20,21,19,17,18,19,17],
'Marks':[85.10,77.80,91,87,90,94,91]}
student_df=pd.DataFrame(student_dict)
print(bottomRows)

print(bottomRows)

# select bottom rows from the multi index dataframe

('Standard 2','Class A'),('Standard 2','Class B'),
('Standard 3','Class A'),('Standard 3','Class B')],
name=['Standard','Class'])

student_df=pd.DataFrame([('Kumbhakaran',67),('Indrajeet',80),('Meghnath',75),
('Sugreev',87),('Bali',90),('Jatayu',94)],
index=index,columns=columns)
print(bottomRows)

# at function
student_dict={'Name':['Kumbhakaran','Indrajeet','Meghnath','Sugreev','Bali','Jatayu','Jambvaan'],
'Age':[20,21,19,17,18,19,17],
'Marks':[85.10,77.80,91,87,90,94,91]}
student_df=pd.DataFrame(student_dict)

print(value)

#iat function
student_dict={'Name':['Kumbhakaran','Indrajeet','Meghnath','Sugreev','Bali','Jatayu','Jambvaan'],
'Age':[20,21,19,17,18,19,17],
'Marks':[85.10,77.80,91,87,90,94,91]}
student_df=pd.DataFrame(student_dict)

Рекомендации по теме