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 13 in Python by Himmi
59 views

1 answer to this question.

0 votes

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 13 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 in Python by Hrishi
27 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 in Python by Neel
• 3,010 points
465 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
• 56,940 points
8,830 views
+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 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 346 views
+4 votes
6 answers
0 votes
1 answer