Calculate Mean And Std Using Pandas In Python
I got a problem when I calculate the mean and std. I loaded an CSV via df = pandas.read_csv('fakedata.csv', skiprows=1, header=None) but then the method df.mean() gives me nothin
Solution 1:
I think the problem relies on the separator. Copying and paste your file into a .csv file, I can read it with:
df = pandas.read_csv("fakedata.csv", skiprows=1, header=None, sep='\s+')
getting as result:
In [18]: df.mean()
Out[18]:
0 50.574475
1 49.585400
2 169.478500
3 59.544800
4 119.814275
5 79.557500
6 79.497775
dtype: float64
and:
In [19]: df.std()
Out[19]:
0 19.787459
1 19.762996
2 14.997920
3 10.034209
4 40.013550
5 19.887973
6 14.947894
dtype: float64
Post a Comment for "Calculate Mean And Std Using Pandas In Python"