Find the sum and maximum value of the two column in excel file using Pandas Last Updated : 27 Aug, 2021 Comments Improve Suggest changes Like Article Like Report 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. sample_data.xlsx Then we have to compute the sum of two-column and find out the maximum value and store into a new DataFrame column. Approach : 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. Python3 # import module import pandas as pd # read from excel # and store in a DataFrame df = pd.read_excel('excel_work/book_sample.xlsx') df Output : Step 2: Create a new column for storing sum and max Python3 # creation new column df['Total'] = None df['Maximum'] = None df Output : Step 3: Set an index for accessing the required column. Python3 # Set index for each column index_selling=df.columns.get_loc('Selling Price') index_cost=df.columns.get_loc('Cost price') index_total=df.columns.get_loc('Total') index_max=df.columns.get_loc('Maximum') print(index_selling,index_cost,index_total,index_max) Output : 2 3 4 5 Step 4: Select each row and add a column and find maximum Python3 for row in range(0, len(df)): df.iat[row, index_total] = df.iat[row, index_selling] + df.iat[row, index_cost] if df.iat[row, index_selling] > df.iat[row, index_cost]: df.iat[row, index_max] = df.iat[row, index_selling] else: df.iat[row, index_max] = df.iat[row, index_cost] df Output : Comment More infoAdvertise with us Next Article Find the sum and maximum value of the two column in excel file using Pandas kumar_satyam Follow Improve Article Tags : Python Python-pandas Python pandas-io Practice Tags : python Similar Reads How to import excel file and find a specific column using Pandas? To read specific columns from an Excel file in Pandas, you have the flexibility to use either column indices or letters. This is achieved by setting the usecols argument, which can take a comma-separated string or a list containing column identifying letters or indices. In this article, we will lear 5 min read Highlight the maximum value in last two columns in Pandas - Python In this article, we will discuss how to highlight the maximum values in Pandas Dataframe. Let's first make a dataframe: Example: Python3 # Import Required Libraries import pandas as pd import numpy as np # Create a dictionary for the dataframe dict = {'Name': ['Sumit Tyagi', 'Sukritin', 'Akriti Goel 2 min read Highlight the maximum value in each column in Pandas Let's discuss how to highlight the maximum values in Pandas Dataframe. Lets first make a dataframe: Example: Python3 # Import Required Libraries import pandas as pd import numpy as np # Create a dictionary for the dataframe dict = {'Name': ['Sukritin', 'Sumit Tyagi', 'Akriti Goel', 'Sanskriti', 'Abh 2 min read Highlight the minimum value in each column In Pandas In this article, we will discuss how to Highlight the minimum values in Pandas Dataframe. So, Let's first make a dataframe: Python3 # Import Required Libraries import pandas as pd import numpy as np # Create a dictionary for the dataframe dict = { 'Name': ['Sumit Tyagi', 'Sukritin', 'Akriti Goel', ' 3 min read How to Get the maximum value from the Pandas dataframe in Python? Python Pandas max() function returns the maximum of the values over the requested axis. Syntax: dataframe.max(axis) where, axis=0 specifies columnaxis=1 specifies rowExample 1: Get maximum value in dataframe row To get the maximum value in a dataframe row simply call the max() function with axis set 2 min read Find Exponential of a column in Pandas-Python Let's see how to find Exponential of a column in Pandas Dataframe. First, let's create a Dataframe: Python3 # importing pandas and # numpy libraries import pandas as pd import numpy as np # creating and initializing a list values= [ ['Rohan', 5, 50.59], ['Elvish', 2, 90.57], ['Deepak', 10, 98.51], [ 2 min read How to Get the minimum value from the Pandas dataframe in Python? In this article, we will discuss how to get the minimum value from the Pandas dataframe in Python. We can get the minimum value by using the min() function Syntax: dataframe.min(axis) where, axis=0 specifies columnaxis=1 specifies rowGet minimum value in dataframe row To get the minimum value in a 2 min read Python | Pandas series.cummax() to find Cumulative maximum of a series Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Series.cummax() is used to find Cumulative maximum of a series. In cumulative m 3 min read How to import an excel file into Python using Pandas? It is not always possible to get the dataset in CSV format. So, Pandas provides us the functions to convert datasets in other formats to the Data frame. An excel file has a '.xlsx' format. Before we get started,  we need to install a few libraries. pip install pandas pip install xlrd  For importin 2 min read Get the index of maximum value in DataFrame column Pandas DataFrame is two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). Let's see how can we get the index of maximum value in DataFrame column.Observe this dataset first. We'll use 'Weight' and 'Salary' columns of this data in order t 2 min read Like