'Pivot table python, I get an empty data frame

I want to transpose this dataframe so I have different cluster as columns and the extreme column as values. The dataframe

      Clusters_4       date extreme
0              3 1979-05-01      No
1              1 1979-05-02     Yes
2              1 1979-05-03      No
3              1 1979-05-04      No
4              1 1979-05-05      No
         ...        ...     ...
6421           1 2020-09-26      No
6422           2 2020-09-27      No
6423           2 2020-09-28      No
6424           2 2020-09-29      No
6425           0 2020-09-30      No

and the code I use:

    les2 = les1.pivot_table(values='extreme', index='date', columns='Clusters_4')

But I get an empty dataframe. Any idea?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source