title: What are good methods to deal with outliers when calculating mean of data?
body: <p>I'm having a dataframe with yearly energy uses of buildings over 5 years. In order to have a representative yearly energy use for data modelling, I'll have to take the mean of those data. As the data can contain outliers, I want to deal with outliers correctly (but keeping as much proper data as possible). (the df can contain empty cells (and older years are a little more important than recent years if a weighted decision has to be made somewhere))</p>
  
  <p>What are good methods to deal with outliers when calculating the mean of data?</p>
  
  <p>I thought off:
  -calculating the mean of the 5 datacolumns (y_2010 - y_2014) and then comparing all 5 datapoints with that mean. If there's a difference of e.g. >20%, this case is deleted and cannot be used for further analysis as there's to much variability in the data for that ID. (Normally the energy data over 5 years should be more or less the same unless retrofits have been done to the building, but most buildings haven't.)
  - doing something with a rolling mean to come to a proper mean building energy use column
  - ...</p>
  
  <p>Example of the df:</p>
  
  <pre><code>   ID  y_2010   y_2011   y_2012  y_2013  y_2014  mean
  21524   22631    21954    22314   22032   21843   ...
  28965   27456    29654    28159   28654   27345   ...
  10236   32165      NaN    31678   31895   32459   ...
  89754   87621    86542    87542   88456   86961   ...
  56457   58951    57486     2000       0       0   ...
  25984   24587    25478      NaN   24896   25461   ...
  </code></pre>