Mean of Columns & Rows of pandas DataFrame in Python (Examples) | Each Column & Row | mean Function

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

import pandas as pd # Import pandas

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

# x1 5.857143
# x2 4.000000
# x3 7.000000
# dtype: float64

# 0 6.000000
# 1 5.333333
# 2 8.000000
# 3 6.000000
# 4 6.000000
# 5 2.666667
# 6 5.333333
# dtype: float64

Follow me on Social Media:

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