My dataframe
date Stk A Stk B Stk C Stk D
01.01 0.03 0.0102 0.034 0.083232
02.02 0.05 0.017 0.0578 0.13872
03.03 0.04 0.0136
Using pandas library in python
import pandas as pd
stats=pd.DataFrame()
stats["mean"]=data.mean()
stats["Std.Dev"]=data.std()
stats["Var"]=data.var()
And then transpose it like
stats.T
You can do something like this:
option 1
pd.DataFrame([df.mean(), df.std(), df.var()], index=['Mean', 'Std. dev', 'Variance'])
or something like this:
option 2
df2 = df.describe().loc[['mean', 'std']]
df2.loc['variance'] = df2.loc['std']**2
df.describe() will do the trick.
my_df.describe()
Age
count 37471.000000
mean 43.047317
std 20.676562
min 1.000000
25% 28.000000
50% 43.000000
75% 59.000000
max 117.000000