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
>>> df['t1'].quantile(np.array([0.25, 0.5, 0.75]))
0.25 2 days
0.50 3 days
0.75 4 days
Name: t1, dtype: timedelta64[ns]
The larger issue is that the get_numeric_data in BlockManager doesn't pick up timedelta data.
The quantile issue arrises in the BlockManager here, https://github.com/pandas-dev/pandas/blob/master/pandas/core/internals.py#L3596, because I TimeDeltaBlocks have is_numeric=False. Not entire sure if is_numeric=True would be the right fix as it might have impacts downstream (one test in pandas/tests/frame/test_analytics.py failed after changing it.)
Expected Output
pd.concat([df['t1'].quantile(np.array([0.25, 0.5, 0.75])), df['t2'].quantile(np.array([0.25, 0.5, 0.75]))], axis=1)
t1 t2
0.25 2 days 02:00:00
0.50 3 days 03:00:00
0.75 4 days 04:00:00
@mroeschke : This indeed looks strange. Poke around to see what fix works best. If you get stuck, feel free to submit what you have as a PR, and we can examine further.
so we treat Timedelta as non-numeric (like datetime). But some operatators can deal with this type of data (e.g. min, max, median, quantile), so this should work (I am pretty sure we test on datetime for this, but obviously not fully on quantile).
Timedeltas are a special beast because they are numeric in numpy.
Problem description
This works for Series:
The larger issue is that the
get_numeric_data
inBlockManager
doesn't pick up timedelta data.The quantile issue arrises in the
BlockManager
here, https://github.com/pandas-dev/pandas/blob/master/pandas/core/internals.py#L3596, because ITimeDeltaBlock
s haveis_numeric=False
. Not entire sure ifis_numeric=True
would be the right fix as it might have impacts downstream (one test inpandas/tests/frame/test_analytics.py
failed after changing it.)Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 2.7.13.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-45-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.20.3
pytest: 3.2.1
pip: 9.0.1
setuptools: 27.2.0
Cython: 0.26
numpy: 1.13.1
scipy: 0.19.1
xarray: None
IPython: 5.3.0
sphinx: 1.5.6
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.2
feather: None
matplotlib: 2.0.2
openpyxl: 2.4.8
xlrd: 1.0.0
xlwt: 1.2.0
xlsxwriter: 0.9.8
lxml: 3.8.0
bs4: 4.3.2
html5lib: 0.9999999
sqlalchemy: 1.1.13
pymysql: 0.7.9.None
psycopg2: 2.7.1 (dt dec pq3 ext lo64)
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: