UPDATE:
In [143]: df Out[143]: Column 0 22 1 38 2 26 3 35 4 35 5 54 .. ... 37 21 38 49 39 29 40 65 41 21 42 28.май [43 rows x 1 columns] In [144]: df.dtypes Out[144]: Column object dtype: object In [145]: pd.to_numeric(df['Column'], errors='coerce').sum() Out[145]: 1181.0
Previous answer:
Most likely the column is not a numeric type:
works for numbers:
In [116]: df = pd.DataFrame({'column':[1,2,np.nan,11,np.nan]}) In [117]: df Out[117]: column 0 1.0 1 2.0 2 NaN 3 11.0 4 NaN In [118]: df['column'].sum() Out[118]: 14.0
does not work for strings:
In [119]: df = pd.DataFrame({'column':['1','2',np.nan,'11',np.nan]}) In [120]: df Out[120]: column 0 1 1 2 2 NaN 3 11 4 NaN In [121]: df['column'].sum() ... skipped ... TypeError: Can't convert 'int' object to str implicitly
Decision:
In [122]: pd.to_numeric(df['column'], errors='coerce').sum() Out[122]: 14.0
error traceback, can you give an example of your data, specify theerror tracebackand also indicate the type of the columncolumn-print(df.dtypes)? - MaxU