I am confused that we had a column in data frame, namely Pclass with class number 1 2 3

pclass
1
2
3
1

we made dummy of the pclass using get_dummies and we get this value

pclass    class_1    class_2    Class_3
1                 1                0                 0
2                 0                1                 0
3                 0                0                 1
1                 1                0                 0

Now how to calculate standard deviation of class_1 and class_2 combined.

1 Answers

0
bubble On

This simple example might be helpful:

import pandas as pd
df = pd.DataFrame({'a' :  pd.np.arange(10), 'b': pd.np.arange(10)})
pd.np.r_[df.loc[:,'a'].values, df.loc[:,'b'].values].std()

or (in your case):

pd.np.r_[df.loc[:,'class_1'].values, df.loc[:,'class_2'].values].std()