Back
In the above dataframe, I would like to get the average of each row. currently, I am doing this:
df.mean(axis=0)
However, this does away with the Region column as well. how can I compute mean and also retain Region column
You can define a new column. You also need to estimate the mean value along the rows, so use axis=1, refer the following code:
If you are interested in learning Pandas and want to become an expert in Python Programming, then check out this Python Course and upskill yourself.
31k questions
32.8k answers
501 comments
693 users