Python script for how much total salary cost has increased

0 votes

I have salaries in a csv file along with name, year and other details. How to Compute how much total salary cost has increased from year 2011 to 2014?

Feb 14, 2019 in Python by Himmi
1,742 views

1 answer to this question.

+1 vote

Here you can use groupby() and mean() to get the desired results.

Please try with the below sample code and check.

import pandas as pd

import matplotlib.pyplot as plt

data=pd.read_csv('D:\\Priyanka\\Downloads\\Salaries.csv')

df=pd.DataFrame(data)

print(df)

mean_year = data.groupby('Year').mean()['TotalPay']

print ( mean_year)
answered Feb 14, 2019 by Umar

Related Questions In Python

0 votes
1 answer

How to make python script pause for sometime?

You can use the sleep method from the ...READ MORE

answered Apr 4, 2019 in Python by Hrishi
802 views
0 votes
1 answer

How to write a python script for downloading a video from YouTube and saving it to a directory?

First download pytube using the following code  pip ...READ MORE

answered Sep 4, 2019 in Python by Neel
• 3,020 points
2,713 views
0 votes
1 answer
0 votes
1 answer

How can I check for NaN in Python?

math.isnan() Checks if the float x is a ...READ MORE

answered Aug 16, 2018 in Python by Priyaj
• 58,020 points
24,269 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,463 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,120 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP