Q:

Python Series.mean() Vs List.mean() , getting different responses

Here is a sample data i have in excel 

Salary in Rs.

12598
25031
25187
25226
25232
37512
37592
50145
50274
62630
62768
75392
87654

And i am trying to read the data using the pandas ExcelFile and parse the sheet after wards. 
I am trying to get the mean of the above values  through
ExcelValue=pandas.ExcelFile("stats.xlsx")
Sheet1=ExcelValue.parse("sheet1")

var1=Sheet1["Salary in Rs."]
var2=var1.tolist()
mean1=statistics.mean(var1) # getting mean as 44403.153846153844
mean2=statistics.mean(var2)  # getting mean as 44403

both are returning different values , am not understaing that .can you please help

A:

It seems as though the integer values passed to statistics.mean for your series are resulting in your output value being truncated as an integer. There are two solutions:

You force the series to contain floats - var1 = Sheet1["Salary in Rs."].astype(float)
You ignore statistics entirely and use the mean method  built into the pandas Series object - var1.mean()

