You can just sum and set axis=1 to sum the rows, which will ignore non-numeric columns; from pandas 2.0+ you also need to specify numeric_only=True.

In [91]:

df = pd.DataFrame({'a': [1,2,3], 'b': [2,3,4], 'c':['dd','ee','ff'], 'd':[5,9,1]})
df['e'] = df.sum(axis=1, numeric_only=True)
df
Out[91]:
   a  b   c  d   e
0  1  2  dd  5   8
1  2  3  ee  9  14
2  3  4  ff  1   8

If you want to just sum specific columns then you can create a list of the columns and remove the ones you are not interested in:

In [98]:

col_list= list(df)
col_list.remove('d')
col_list
Out[98]:
['a', 'b', 'c']
In [99]:

df['e'] = df[col_list].sum(axis=1)
df
Out[99]:
   a  b   c  d  e
0  1  2  dd  5  3
1  2  3  ee  9  5
2  3  4  ff  1  7

sum docs

Answer from EdChum on Stack Overflow
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.sum.html
pandas.DataFrame.sum — pandas 3.0.6 documentation
The behavior of DataFrame.sum with axis=None is deprecated, in a future version this will reduce over both axes and return a scalar To retain the old behavior, pass axis=0 (or do not pass axis).
🌐
Pandas
pandas.pydata.org › docs › dev › reference › api › pandas.DataFrame.sum.html
pandas.DataFrame.sum — pandas 3.1.0.dev0 documentation
The behavior of DataFrame.sum with axis=None is deprecated, in a future version this will reduce over both axes and return a scalar To retain the old behavior, pass axis=0 (or do not pass axis).
🌐
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. Note: We can also pass axis=0 inside sum() to compute the sum of each column. import pandas as pd # create a DataFrame df = pd.DataFrame({ 'A': [1, 2, 3], 'B': [4, 5, 6], ...
🌐
GeeksforGeeks
geeksforgeeks.org › pandas › python-pandas-dataframe-sum
Pandas dataframe.sum() - GeeksforGeeks
July 11, 2025 - Explanation: This code creates ... adds all values in each column separately. When summing along rows (axis=1), it adds values in each row....
🌐
Medium
medium.com › @amit25173 › understanding-pandas-dataframe-sum-a23521d6937b
Understanding pandas.DataFrame.sum() | by Amit Yadav | Medium
March 6, 2025 - You might be wondering: How do I use it? ... axis: This controls the direction of the sum. By default, it's set to 0, meaning it will sum the columns. If you want to sum the rows, set axis=1...
🌐
Pandas
pandas.pydata.org › pandas-docs › stable › reference › api › pandas.DataFrame.sum.html
pandas.DataFrame.sum — pandas 3.0.5 documentation
The behavior of DataFrame.sum with axis=None is deprecated, in a future version this will reduce over both axes and return a scalar To retain the old behavior, pass axis=0 (or do not pass axis).
Find elsewhere
🌐
Arab Psychology
scales.arabpsychology.com › home › how to easily sum specific columns in pandas
How To Easily Sum Specific Columns In Pandas
December 2, 2025 - By default, without specifying ... the direction of the operation using the axis parameter. When you set axis=1, you instruct Pandas to perform the calculation horizontally, across the columns....
🌐
Pandas
pandas.pydata.org › pandas-docs › version › 1.5 › reference › api › pandas.DataFrame.sum.html
pandas.DataFrame.sum — pandas 1.5.3 documentation
This is equivalent to the method numpy.sum. ... Axis for the function to be applied on. For Series this parameter is unused and defaults to 0. ... Exclude NA/null values when computing the result. ... If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a Series. Deprecated since version 1.3.0: The level keyword is deprecated.
🌐
Statology
statology.org › home › how to sum specific columns in pandas (with examples)
How to Sum Specific Columns in Pandas (With Examples)
December 2, 2021 - You can use the following methods to find the sum of a specific set of columns in a pandas DataFrame: ... #specify the columns to sum cols = ['col1', 'col4', 'col5'] #find sum of columns specified df['sum'] = df[cols].sum(axis=1)
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-sum-values-of-pandas-dataframe-by-rows
How to sum values of Pandas dataframe by rows? - GeeksforGeeks
March 26, 2021 - Pandas dataframe.sum() function returns the sum of the values for the requested axis. ... Summing all the rows of a Dataframe using the sum function and setting the axis value to 1 for summing up the row values and displaying the result as output.
🌐
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....
🌐
Medium
medium.com › @heyamit10 › understanding-axis-in-pandas-with-examples-df5997702596
Understanding axis in Pandas with Examples | by Hey Amit | Medium
March 6, 2025 - ✅ Need to sum across columns? Use axis=1. ✅ Need to sum down rows? Use axis=0. ✅ Need to drop a column? Use axis=1. ✅ Need to drop a row? Use axis=0. ✅ Need to flip your DataFrame? Use .T. It’s that simple! Once you get used to axis, you’ll never struggle with Pandas operations again.