且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在非唯一列中按日期对pandas DataFrame条目进行分组

更新时间:2022-12-12 17:56:59

我正在使用熊猫0.16.2.这在我的大型数据集上具有更好的性能:

I'm using pandas 0.16.2. This has better performance on my large dataset:

data.groupby(data.date.dt.year)

使用dt选项并玩弄weekofyeardayofweek等变得容易得多.

Using the dt option and playing around with weekofyear, dayofweek etc. becomes far easier.