Skip to content

BUG: 2D DTA/TDA arithmetic with object-dtype #32185

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

Merged
merged 11 commits into from
Mar 3, 2020

Conversation

jbrockmendel
Copy link
Member

The main motivation for this is that it is prerequisite for implementing frame-with-frame ops blockwise. It also fixes a few broken cases:

  • dta - dta.astype(object) currently raises TypeError
  • ditto dti - dti.astype(object)
  • tda + dta.astype(object) returns ndarray of timestamps instead of DatetimeArray

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need a whatsnew note?

# e.g. we've passed a Timestamp to TimedeltaArray
res = res_values
return res
# Note: we are assuming here that shapes match.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls add an assert then

@@ -2395,3 +2408,31 @@ def test_shift_months(years, months):
raw = [x + pd.offsets.DateOffset(years=years, months=months) for x in dti]
expected = DatetimeIndex(raw)
tm.assert_index_equal(actual, expected)


def test_dt64arr_addsub_object_dtype_2d():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok with either class based or free functions, mixing is slightly odd.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah, this is a bit of an odd-man-out because the class-based tests are all trying to use box_with_array, whereas this is specifically aiming at the 2D array case

@jreback jreback added Bug Dtype Conversions Unexpected or buggy dtype conversions Reshaping Concat, Merge/Join, Stack/Unstack, Explode Datetime Datetime data dtype labels Feb 23, 2020
@jbrockmendel
Copy link
Member Author

@jreback gentle ping; this is a blocker for the upcoming blockwise frame-with-frame perf fix

@jreback jreback added this to the 1.1 milestone Mar 3, 2020
@jreback jreback merged commit bdcb5da into pandas-dev:master Mar 3, 2020
@jreback
Copy link
Contributor

jreback commented Mar 3, 2020

thanks. this looks user facing? if so can you follow up with a whatsnew note .

@jbrockmendel jbrockmendel deleted the dta-arith-2d branch March 9, 2020 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype Dtype Conversions Unexpected or buggy dtype conversions Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants