-1

This is the output of a code run, and i would like to know how am i able to count the sum of values of the column 'age' in this table output

value age change
Car 110 10 1
Drum 46 3 0
Bottle 12 510 1
Shoes 80 29 1
Mechanic Pig
  • 6,756
  • 3
  • 10
  • 31
linTan
  • 1
  • 1

1 Answers1

0

df['age'].sum() (considering that the table is called df)

guin0x
  • 337
  • 2
  • 10
  • will be getting KeyError: 'age' – linTan Aug 20 '22 at 11:19
  • This error means that the column name is not `age` but something else... Maybe it's `age `? (With a space after)... Try `df.columns = df.columns.str.replace(' ', '')` first to remove any space that might exist in the column names and then retry the function I proposed in the answer. – guin0x Aug 20 '22 at 11:48