When creating a daterange with a decimal number of minutes, pandas truncates everything before the decimal point. This leads to odd results e.g. if you're expecting to generate something every half minute and instead end up with something every 5 minutes, and even odder results if you have a float that is a whole number.
A less contrived example is if pandas is used to process the results of some API call where you don't know what unit you'll have to go to to get to a whole number. It would be safe, I guess, to convert everything to nanoseconds, but not especially readable.
A small, complete example of the issue
>>> import pandas as pd
>>> pd.date_range(end='2016-10-07T21:08:58.490180', periods=3, freq='0.5min')
DatetimeIndex(['2016-10-07 20:58:58.490180', '2016-10-07 21:03:58.490180',
'2016-10-07 21:08:58.490180'],
dtype='datetime64[ns]', freq='5T')
>>> pd.date_range(end='2016-10-07T21:08:58.490180', periods=3, freq='10080.0min')
DatetimeIndex([], dtype='datetime64[ns]', freq='0T')
Expected Output
For the first example:
DatetimeIndex(['2016-10-07 21:07:58.490180', '2016-10-07 21:08:28.490180',
'2016-10-07 21:08:58.490180'],
dtype='datetime64[ns]', freq='30S')
For the second:
DatetimeIndex(['2016-09-23 21:08:58.490180', '2016-09-30 21:08:58.490180',
'2016-10-07 21:08:58.490180'],
dtype='datetime64[ns]', freq='10080T')
Output of pd.show_versions()
Comment From: jisantuc
After following traceback I don't think this would be hard to fix, so I'm happy to do that if it's agreed that what I expected is a reasonable expectation.
Comment From: jreback
this is a duplicate of https://github.com/pydata/pandas/issues/8419
welcome a fix for that (you can use your example and the other as examples).