I was trying to make a weighed average and I came across a doubt:

Problem
-------

I wanted to create a new column named answer that calculates the result between each line and a list of weighted values named in this case as `month`. If I use `df.mean()` I would get a simple average by month and that is not what I want. The idea is to give more importance to the end of the year and less importance to the demand in the begging of the year. So that's why I would like to use weighted average calculation. 

In **excel** I would use the formula bellow. I'm having troubles to convert this calculation to pandas data frame. 

`=SUMPRODUCT( demands[@[1]:[12]] ; month )/SUM(month)`

I couldn't find a solution to this problem and I really appreciate help with this subject.

Thank you in advance.

Here's a dummy dataframe that serves as an example:

Example Code
------------

```
demand = pd.DataFrame({'1': [360, 40, 100, 20, 55],
                       '2': [500, 180, 450, 60, 50],
                       '3': [64, 30, 60, 10, 0],
                       '4': [50, 40, 30, 60, 50],
                       '5': [40, 24, 45, 34, 60],
                       '6': [30, 34, 65, 80, 78],
                       '7': [56, 45, 34, 90, 58],
                       '8': [32, 12, 45, 55, 66],
                       '9': [32, 56, 89, 67, 56],
                       '10': [57, 35, 75, 48, 9],
                       '11': [56, 33, 11, 6, 78],
                       '12': [23, 65, 34, 8, 67]
                      })

months = [i for i in range(1,13)]

```

Visualization of the problem
----------------------------

[![problem](https://i.stack.imgur.com/0pvLP.png)](https://i.stack.imgur.com/0pvLP.png)