Skip to content

implement maybe_wrap_in_index for EA Mixin dispatch #21715

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

Conversation

jbrockmendel
Copy link
Member

Implements maybe_wrap_in_index, shows the easiest places where it can be used. If merged, the follow-on will be to move the affected methods to the EA mixin classes, leaving just the dispatch/wrapping behind.

Implements _local_timestamps on the DatetimeArrayMixin, since that will be needed before we can move the comparison operators among others.

@gfyoung gfyoung added Enhancement ExtensionArray Extending pandas with custom dtypes or arrays. labels Jul 3, 2018
@codecov
Copy link

codecov bot commented Jul 3, 2018

Codecov Report

Merging #21715 into master will increase coverage by <.01%.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #21715      +/-   ##
==========================================
+ Coverage   91.92%   91.93%   +<.01%     
==========================================
  Files         158      158              
  Lines       49703    49708       +5     
==========================================
+ Hits        45689    45698       +9     
+ Misses       4014     4010       -4
Flag Coverage Δ
#multiple 90.3% <94.11%> (ø) ⬆️
#single 42% <38.23%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/arrays/datetimes.py 100% <100%> (ø) ⬆️
pandas/core/indexes/period.py 92.57% <100%> (ø) ⬆️
pandas/core/indexes/datetimes.py 95.45% <100%> (-0.04%) ⬇️
pandas/core/indexes/timedeltas.py 91.37% <100%> (+0.17%) ⬆️
pandas/core/indexes/datetimelike.py 97.32% <81.81%> (+0.6%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f32214...4c6f25e. Read the comment docs.

@@ -1137,3 +1133,29 @@ def _ensure_datetimelike_to_i8(other):
# period array cannot be coerces to int
other = Index(other).asi8
return other


def maybe_wrap_in_index(result, name=None, strict=True):
Copy link
Contributor

Choose a reason for hiding this comment

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

so this doesn't belong here, prob should just be in .base itself. why do you need the strict parameter? that is really 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.

indexes.base makes sense, sure.

The strict parameter is there because most of the use cases don't have the try/except for the index wrapping. strict=False is only passed for the comparison ops. I'll see if I can come up with something prettier. At least this has served its purpose of tagging the next few things to be moved.

@jbrockmendel
Copy link
Member Author

Part of this PR is superseded by #21721. The other part is in limbo. Closing to clear the queue.

@jbrockmendel jbrockmendel deleted the dtarrays-props-easy branch July 5, 2018 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ExtensionArray Extending pandas with custom dtypes or arrays.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants