Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: TypeError in merge with timedelta64 column #13389

Closed
b11z opened this issue Jun 7, 2016 · 1 comment
Closed

BUG: TypeError in merge with timedelta64 column #13389

b11z opened this issue Jun 7, 2016 · 1 comment
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timedelta Timedelta data type
Milestone

Comments

@b11z
Copy link

b11z commented Jun 7, 2016

>>> import pandas as pd
>>> df1 = pd.DataFrame({'entity_id': [101, 102]})
>>> df2 = pd.Series([None, None], index=[101, 102]).astype('timedelta64[D]').to_frame('days')
>>> print(df2); print(df2.dtypes)
     days
101   NaT
102   NaT
days    timedelta64[D]
dtype: object

>>> df1.merge(df2, left_on='entity_id', right_index=True)
...
  File "/Users/brian/src/pandas/pandas/core/common.py", line 95, in isnull
    return _isnull(obj)
  File "/Users/brian/src/pandas/pandas/core/common.py", line 105, in _isnull_new
    return _isnull_ndarraylike(obj)
  File "/Users/brian/src/pandas/pandas/core/common.py", line 196, in _isnull_ndarraylike
    result = np.isnan(values)
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Expected output:

   entity_id  days
0        101   NaT
1        102   NaT

INSTALLED VERSIONS

commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Darwin
OS-release: 15.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.18.1
nose: 1.3.7
pip: 8.1.2
setuptools: 22.0.5
Cython: None
numpy: 1.11.0
scipy: 0.17.0
statsmodels: None
xarray: None
IPython: 4.0.1
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: 2.5.1
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.10
pymysql: None
psycopg2: 2.6.1 (dt dec pq3 ext)
jinja2: 2.7.3
boto: 2.38.0
pandas_datareader: None

(It also appears on master)

@jreback
Copy link
Contributor

jreback commented Jun 7, 2016

yeah this is prob not tested very well. pull-requests are welcome.

@jreback jreback added Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timedelta Timedelta data type Difficulty Intermediate labels Jun 7, 2016
@jreback jreback added this to the Next Major Release milestone Jun 7, 2016
@jreback jreback modified the milestones: 0.19.0, Next Major Release Jul 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants