Find the sum and maximum value of the two column in excel file using Pandas
In these articles, we will discuss how to read data from excel and perform some mathematical operation and store it into a new column in DataFrame. Suppose our excel file looks like this.
Then we have to compute the sum of two-column and find out the maximum value and store into a new DataFrame column.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
- Import Pandas module.
- Read data from Excel.
- Create a new column for storing Sum and maximum.
- Set the Index of each column for accessing the element.
- Store the sum of two-columns in a new column.
- And store Maximum number from two columns in a column.
- Display DataFrame.
Step 1: Importing module and reading from excel.
Step 2: Create a new column for storing sum and max
Step 3: Set an index for accessing the required column.
2 3 4 5
Step 4: Select each row and add a column and find maximum