Description
This is a suggestion, not a bug. The following resulted in a FutureWarning
df = df.assign(block=(df.index.to_series().diff() != pd.Timedelta(15,'m')).cumsum())
FutureWarning: The default of the 'keep_tz' keyword will change to True in a future release. You can set 'keep_tz=True' to obtain the future behaviour and silence this warning.
It wasn't in any way obvious why since the warning doesn't mention the method name and there's no stack trace (and futures warnings are only printed once). I had to search the source (which was also difficult as the message was split to maintain a character limit per line).
It would be nice if future warnings were more explicit, i.e. name the class and method as well as the argument.
(In this case it's the to_series()
method, which ideally wouldn't be required but DateTimeIndex
doesn't yet implement diff())