I am trying to calculate the mean and confidence interval(95%) of a column "Force" in a large dataset. I need the result by using the groupby function by grouping different "Classes".
When I calculate the mean and put it in the new dataframe, it gives me NaN values for all rows. I'm not sure if I'm going the correct way. Is there any easier way to do this?
This is the sample dataframe:
df=pd.DataFrame({ 'Class': ['A1','A1','A1','A2','A3','A3'],
'Force': [50,150,100,120,140,160] },
columns=['Class', 'Force'])
To calculate the confidence interval, the first step I did was to calculate the mean. This is what I used:
F1_Mean = df.groupby(['Class'])['Force'].mean()
This gave me NaN
values for all rows.