For some mysterious reason, I have a dataframe that looks like
index col_weird col_normal
2012-01-01 14:30 ['A','B'] 2
2012-01-01 14:32 ['A','C','D'] 4
2012-01-01 14:36 ['C','D'] 2
2012-01-01 14:39 ['E','B'] 4
2012-01-01 14:40 ['G','H'] 2
I would like to re-change my data file every 5 minutes, and
Of course, the use resample().col_weird.nunique()will fail with the first task, because I want a unique number of elements: between 14:30and 14:35I expect this number to be 4, corresponding to A, B, CD.
During the same period, the average is col_normal, of course, 3.
Any idea how to get this?
Thank!
source
share