I have dataframe like this.
E F
ID A B C D E F
0 0 ABC AAA BCD 1 -
1 1 ABC AAA BCD 4 -
2 2 ABC AAA BCD 6 -
I print type of dataframe by print(type(df['E'])) it show output like this.
<class 'pandas.core.series.Series'>
I try to sum total value in column E but it show output like this
E146
How to sum data in dataframe column? The correct value should be 11 (1+4+6).
Use:
print(df['E'].iloc[1:].astype(int).sum())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With