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
11 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
9 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,120 points
1,801 views
0 votes
1 answer

How do play audio (playsound) in background of Python script?

In windows: Use winsound.SND_ASYNC to play them asynchronously import winsound winsound.PlaySound("filename", winsound.SND_ASYNC ...READ MORE

answered Sep 5, 2018 in Python by Priyaj
• 56,120 points
1,650 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
20 views
+4 votes
6 answers
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.