Here is my code to generate a dataframe:
import pandas as pd
import numpy as np
dff = pd.DataFrame(np.random.randn(1, 2), columns=list('AB'))
then I got the dataframe:
A B
0 0.626386 1.52325
When I type the command dff.mean(axis=1)
, I get:
0 1.074821
dtype: float64
According to the reference of pandas, axis=1
stands for columns and I expect the result of the command to be
A 0.626386
B 1.523255
dtype: float64
So what does axis in pandas mean?