QST: pd.pivot_table() generates wrong sums
- [ X ] I have searched the [[pandas] tag](https://stackoverflow.com/questions/tagged/pandas) on StackOverflow for similar questions.

- [ X ] I have asked my usage related question on [StackOverflow](https://stackoverflow.com).

---

#### Question about pandas

I have stumbled upon a strange phenomenon...

The same question asked on [StackOverflow](https://stackoverflow.com/questions/60883087/pandas-pivot-table-generates-wrong-sums)

I have a working code to generate pivoted tables from data uploaded from excels. I have stumbled on a strange case where after applying pivot_table to the data, I get different summed values than before pivot...

I generate data from xlsx and xls files, do some stuff with it and then want to generate a pivoted table. Before the pivot I do df.VAL1.sum() and df.VAL2.sum() and the values are the same ones as the ones summed in excels using =sum(), but after I run my pd.pivot_table() code I get a different result when I do pivot.sum()

The data has the following columns:
```
COL1 COL2 COL3 time_period VAL1 VAL2 UNIT_VAL1 COL4 COL5 COL6 UNIT_VAL2 COL7 COL8 COL9
```
where time_period is a string - YYYY-MM

and here is the pivot_table attributes:

```python
pivot = pd.pivot_table(
    df[[
        'COL1', 'COL2', 'COL3', 'COL9', 'time_period',
        'VAL1','COL8', 'COL4', 'COL5', 'COL6', 'COL7', 'UNIT_VAL1'
    ]],
    values='VAL1',
    columns='time_period',
    index=[
        'COL7', 'COL8', 'COL3', 'COL1',
        'COL5', 'COL2', 'COL9',
        'COL4', 'COL6', 'UNIT_VAL1'
    ],
    aggfunc=np.sum
)
```
Can the string `time_period` be the problem here or the order of the passed column names? Or maybe I am doing something wrong here? I want to note that this happens only with 2 dataframes, as other dataframes work well.

I did observe that this pivot code produces different sums after 4 decimal spaces, but that shouldn't change the sums IMHO... Maybe I should use `df.picot_table` instead of `pd.pivot_table` ? The problem is I need two tables from the data frame - one in KG and one in local CUR...
