Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (50.2k points)

I have a DataFrame with numerical values. What is the simplest way of appending a row (with a given index value) that represents the sum of each column?

1 Answer

0 votes
by (107k points)

To add a row with column-totals, you can refer the following code:

df.loc['Total']= df.sum()

If you want to learn more about Pandas then visit this Python Course designed by the industrial experts.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...