Skip to content

Regression: cannot set a Timestamp with a non-timestamp #18660

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

Closed
discort opened this issue Dec 6, 2017 · 1 comment
Closed

Regression: cannot set a Timestamp with a non-timestamp #18660

discort opened this issue Dec 6, 2017 · 1 comment
Labels
Datetime Datetime data dtype Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves

Comments

@discort
Copy link
Contributor

discort commented Dec 6, 2017

Code Sample, a copy-pastable example if possible

import pandas as pd
from datetime import datetime

dates = [pd.Timestamp('2012-01-01'), pd.Timestamp('2017-01-02'), pd.Timestamp('2017-01-03')]
df = pd.DataFrame({'dates': dates})
today = datetime.today().date()
print(df['dates'] == today)
Traceback (most recent call last):
  File "date_bug.py", line 22, in <module>
    main()
  File "date_bug.py", line 18, in main
    print(df['dates'] == today)
  File "/Users/discort/python/projects/pims/env/lib/python3.5/site-packages/pandas/core/ops.py", line 879, in wrapper
    res = na_op(values, other)
  File "/Users/discort/python/projects/pims/env/lib/python3.5/site-packages/pandas/core/ops.py", line 808, in na_op
    y = libindex.convert_scalar(x, _values_from_object(y))
  File "pandas/_libs/index.pyx", line 494, in pandas._libs.index.convert_scalar
  File "pandas/_libs/index.pyx", line 509, in pandas._libs.index.convert_scalar
ValueError: cannot set a Timestamp with a non-timestamp

Problem description

There is a regression. Related: #17965
On 0.18.1 it works fine

Expected Output

0    False
1    False
2    False
Name: dates, dtype: bool

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None

pandas: 0.21.0
pytest: 2.9.2
pip: 9.0.1
setuptools: 36.4.0
Cython: None
numpy: 1.13.3
scipy: None
pyarrow: None
xarray: None
IPython: 6.1.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@jreback
Copy link
Contributor

jreback commented Dec 6, 2017

as indicated this is a dupe of #17965, closed by #18188 and will be in forthcoming 0.21.1

@jreback jreback closed this as completed Dec 6, 2017
@jreback jreback added Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves Datetime Datetime data dtype labels Dec 6, 2017
@jreback jreback added this to the No action milestone Dec 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

No branches or pull requests

2 participants