You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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()
## INSTALLED VERSIONS
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-38-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
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.
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
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()
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-38-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.18.1
nose: 1.3.1
pip: 1.5.4
setuptools: 26.0.0
Cython: None
numpy: 1.11.1
scipy: 0.17.1
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.3.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
httplib2: 0.9.2
apiclient: None
sqlalchemy: 1.0.15
pymysql: None
psycopg2: 2.6.2 (dt dec pq3 ext lo64)
jinja2: 2.8
boto: 2.41.0
pandas_datareader: None
The text was updated successfully, but these errors were encountered: