Description
Code Sample
>>> import pandas as pd
>>> pd.Timestamp('2018-01-12 18:15:00').ceil('15T')
Timestamp('2018-01-12 18:30:00')
>>> pd.Timestamp('2018-01-12 00:30:00').ceil('15T')
Timestamp('2018-01-12 00:45:00')
Problem description
When the frequency is 15min .ceil()
rounds up when the timestamp is divisible by the frequency.
From some experimentation, this also occurs with some other minute frequencies, notably: 2
, 4
, 15
, 20
Minute frequencies that are factors of 60 should have consistent behavior in my opinion (not sure about the behavior of non-factors but those would be rare edge cases).
This appears to be a regression in the latest version of pandas 0.23.0
as it is working as expected in 0.22.0
Expected Output
>>> pd.Timestamp('2018-01-12 18:15:00').ceil('15T')
Timestamp('2018-01-12 18:15:00')
>>> pd.Timestamp('2018-01-12 00:30:00').ceil('15T')
Timestamp('2018-01-12 00:30:00')
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-124-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.23.0
pytest: 2.8.5
pip: 9.0.1
setuptools: 39.2.0
Cython: 0.23.4
numpy: 1.14.3
scipy: 0.17.1
pyarrow: None
xarray: None
IPython: 6.4.0
sphinx: 1.3.1
patsy: 0.4.1
dateutil: 2.7.3
pytz: 2018.4
blosc: None
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.5.2
feather: None
matplotlib: 1.5.1
openpyxl: 2.3.2
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: 0.8.4
lxml: 3.6.0
bs4: 4.4.1
html5lib: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: 2.6.2 (dt dec pq3 ext lo64)
jinja2: 2.8
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None