How to sum two columns in a pandas DataFrame in Python

Summing two columns in a pandas DataFrame adds the entries in each row to each other.

Solution for How to sum two columns in a pandas DataFrame in Python : You can use the addition operator to sum two columns Select each column of DataFrame df through the syntax df[“column_name”] and add them together to get a pandas Series containing the sum of each row. Create a new column in the DataFrame through the syntax df[“new_column”] and set it equal to this Series to add it to the DataFrame.


how-to-sum-two-columns-in-a-pandas-dataframe-in-python