Date ranges in Pandas

后端 未结 3 1132
有刺的猬
有刺的猬 2020-12-30 00:46

After fighting with NumPy and dateutil for days, I recently discovered the amazing Pandas library. I\'ve been poring through the documentation and source code, but I can\'t

相关标签:
3条回答
  • 2020-12-30 00:59

    There actually is no "day of month" frequency (e.g. "DOMXX" like "DOM09"), but I don't see any reason not to add one.

    http://github.com/pydata/pandas/issues/2289

    I don't have a simple workaround for you at the moment because resample requires passing a known frequency rule. I think it should be augmented to be able to take any date range to be used as arbitrary bin edges, also. Just a matter of time and hacking...

    0 讨论(0)
  • 2020-12-30 01:02

    freq='M' is for month-end frequencies (see here). But you can use .shift to shift it by any number of days (or any frequency for that matter):

    pd.date_range(start, end, freq='M').shift(15, freq=pd.datetools.day)
    
    0 讨论(0)
  • 2020-12-30 01:04

    try

    date_range(start, end, freq=pd.DateOffset(months=1))
    
    0 讨论(0)
提交回复
热议问题