Skip to content Skip to sidebar Skip to footer

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]: 
050.574475149.5854002169.478500359.5448004119.814275579.557500679.497775
dtype: float64

and:

In [19]: df.std()
Out[19]: 
019.787459119.762996214.997920310.034209440.013550519.887973614.947894
dtype: float64

Post a Comment for "Calculate Mean And Std Using Pandas In Python"