Get count of value for 15 min periods

I have a DataFrame with a DateTimeIndex. I would like to get the count of all different (integer) values for column col1 for each 15 min period.

I have looked at groupby and count but this doesn't seem to work.

Any suggestion appreciated!

Answers


result = df.groupby(pd.TimeGrouper('15Min')['col1'].apply(lambda x: x.value_counts()))

should do the trick.


Need Your Help

Use User-Defined build settings in custom .plist file

ios xcode plist google-signin

I have different build configurations (Debug, Stage, Prod) defined for my app and I use User-Defined build settings:

Android decompress RAR files programmatically

android

Is there a way to decompress rar files in android 1.6 programmatically?