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: DataFrame and datetime scalar ops may results in incorrect dtype #13248

Closed
sinhrks opened this issue May 21, 2016 · 1 comment
Closed

BUG: DataFrame and datetime scalar ops may results in incorrect dtype #13248

sinhrks opened this issue May 21, 2016 · 1 comment
Labels
Bug Duplicate Report Duplicate issue or pull request Numeric Operations Arithmetic, Comparison, and Logical operations
Milestone

Comments

@sinhrks
Copy link
Member

sinhrks commented May 21, 2016

Code Sample, a copy-pastable example if possible

Timestamp subtraction resuts in Timedelta

pd.Timestamp('2011-01-01') - pd.Timestamp('2010-01-01')
# Timedelta('365 days 00:00:00')

But it doesn't when broadcasted to DataFrame. It's because DataFrame op calls
_try_corce_results which coerces the result to datetime64.

df = pd.DataFrame({'a': [pd.Timestamp('2011-01-01')]})
df - pd.Timestamp('2010-01-01')
#            a
#0 1971-01-01

Expected Output

#          a
#0 365 days

output of pd.show_versions()

current master

@sinhrks sinhrks added Bug Numeric Operations Arithmetic, Comparison, and Logical operations labels May 21, 2016
@sinhrks sinhrks added this to the 0.18.2 milestone May 21, 2016
@jreback
Copy link
Contributor

jreback commented May 21, 2016

dupe of #12437

@jreback jreback closed this as completed May 21, 2016
@jreback jreback added the Duplicate Report Duplicate issue or pull request label May 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Duplicate Report Duplicate issue or pull request Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

No branches or pull requests

2 participants