Get Values of First Row in pandas DataFrame in Python (Examples) | Extract & Return | iloc Attribute

preview_player
Показать описание
Python code of this video:

import pandas as pd # Import pandas library to Python

data = pd.DataFrame({'x1':range(7, 1, - 1), # Create example DataFrame
'x2':[9, 9, 9, 9, 9, 9],
'x3':range(1, 7)})
print(data) # Print example DataFrame

# x1 7
# x2 9
# x3 1
# Name: 0, dtype: int64

print(data['x3'].iloc[0]) # Particular column
# 1

Follow me on Social Media:

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