I think the right way to interpret the axis parameter is what axis you sum 'over' (or 'across'), rather than the 'direction' the sum is computed in. Specifying axis = 0 computes the sum over the rows, giving you a total for each column; axis = 1 computes the sum across the columns, giving you a total for each row.

Answer from anant on Stack Overflow
🌐
W3Schools
w3schools.com › python › pandas › ref_df_sum.asp
Pandas DataFrame sum() Method
import pandas as pd data = [[10, ... returns the sum for each column. By specifying the column axis (axis='columns'), the sum() method searches column-wise and returns the sum of each row....
🌐
Programiz
programiz.com › python-programming › pandas › methods › sum
Pandas sum() (With Examples)
row_sum = df.sum(axis=1) - calculates the sum of values in each row of df by setting axis=1, meaning it operates row-wise.
🌐
GeeksforGeeks
geeksforgeeks.org › pandas › python-pandas-dataframe-sum
Pandas dataframe.sum() - GeeksforGeeks
July 11, 2025 - DataFrame.sum() function in Pandas allows users to compute the sum of values along a specified axis. It can be used to sum values along either the index (rows) or columns, while also providing flexibility in handling missing (NaN) values.
🌐
Medium
medium.com › @amit25173 › understanding-pandas-dataframe-sum-a23521d6937b
Understanding pandas.DataFrame.sum() | by Amit Yadav | Medium
March 6, 2025 - The pandas.sum() function is a powerful tool in pandas that allows you to quickly calculate the sum of values across rows or columns of your DataFrame. You might be wondering: How do I use it? ... axis: This controls the direction of the sum. By ...
Find elsewhere
🌐
EDUCBA
educba.com › home › software development › software development tutorials › pandas tutorial › pandas sum()
Pandas sum() | How Dataframe.sum() Function Works in Pandas?
April 15, 2023 - In the event that it is less than ... the function of the program. Dataframe.sum returns the sum of the series mentioned by the dataframe if the level of the dataframe is known....
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
w3resource
w3resource.com › pandas › dataframe › dataframe-sum.php
Pandas DataFrame: sum() function - w3resource
August 19, 2022 - Pandas DataFrame - sum() function: The sum() function is used to return the sum of the values for the requested axis.
🌐
Saturn Cloud
saturncloud.io › blog › how-to-sum-values-of-a-row-of-a-pandas-dataframe-efficiently
Efficient Techniques for Summing Row Values in Pandas Dataframes | Saturn Cloud Blog
May 1, 2026 - The most efficient way to sum values of a row of a pandas dataframe is to use the sum() method with the axis parameter set to 1. The axis parameter specifies whether to sum the rows (0) or the columns (1).
🌐
Spark By {Examples}
sparkbyexamples.com › home › pandas › pandas dataframe sum() method
Pandas DataFrame sum() Method - Spark By {Examples}
July 31, 2024 - In pandas, the sum() method is used to compute the sum of the values over the requested axis in a DataFrame. It can be applied to both rows and columns,
🌐
Ashishcoder
ashishcoder.com › courses › pandas › sum-method-in-pandas.html
The sum method in Pandas: Tutorial & Examples | Ashish Coder
# Calculate the sum over the rows in the dataframe by specifying the axis parameter df["Total Expenditure"]=df[["Expenditure on Clothes", "Expenditure on Food", "Expenditure on Travelling"]].sum(axis=1) df
🌐
Spark By {Examples}
sparkbyexamples.com › home › pandas › pandas sum dataframe columns with examples
Pandas Sum DataFrame Columns With Examples - Spark By {Examples}
November 4, 2024 - To sum Pandas DataFrame columns (given selected multiple columns) using either sum(), iloc[], eval(), and loc[] functions. Among these Pandas