Which function will display the sum of each column of the DataFrame regardless of its datatype.
Which function will display the sum of each column of the DataFrame regardless of its datatype.
Solution
✅ Correct Option: 1
DataFrame.sum() returns the sum of the values in each column (axis 0 by default). It works on any datatype: numbers are added, and strings are joined (concatenated).
Option 2: add() adds another DataFrame, Series or scalar to the DataFrame element by element. It does not total a column.
Option 3: aggregate() needs a function to apply, such as aggregate('sum'). Called with no argument it does not give column sums.
Option 4: sumvalue() is not a pandas function.
Related questions:
2025: 15 May Shift 2
2025: 30 May Shift 2
2026: 13 May Shift 2
2026: 23 May Shift 1
2025: 15 May Shift 2