-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
ENH - Index set operation modifications to address issue #23525 #23538
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
TomAugspurger
merged 75 commits into
pandas-dev:master
from
ArtinASarraf:enh/index_setops
May 21, 2019
Merged
Changes from all commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
c2cf269
ENH - first pass at modifying set operations on indexes. Dont ignore …
435e50f
Merge branch 'master' into enh/index_setops
4922fd3
BUG - account for empty index + non-monotonic index, and dont try to …
5e528a1
TST - update existing tests to account for cross type index joins bei…
cdaa5b0
ENH - incompatibility checks and incompatible type unions
40d57ec
TST - update datetime union tets, add tests for inconsistent unions
11fd041
CLN - refactor union -> _union
8f0ace3
TST - add tests for categrorical index, and compatible inconsistent p…
8364c2e
BUG - union -> _union in overriden _union methods
ab329a9
TST - update test_operator raised exception
93486ad
CLN - pep8 line adherence
e435e4c
ENH - reverse polarity of compatibility check and add docstrings
b9787b8
Merge branch 'master' into enh/index_setops
2241b65
TST - add test fixture for index factories and use in test_setops
4daf360
ENH - cast difference result to original dtype to match other index b…
6e5a52b
TST - update interval setop test to account for difference now return…
d344e11
CLN - remove unnecceary code from test
b339bd1
CLN - reorganize some code to make it more readable
85e2db7
CLN - pep8 adherence
cf34960
CLN - pep8 adherence
7150c22
BUG - fix function name
fbb3743
Merge branch 'master' into enh/index_setops
5aa41f6
BUG - fix numeric index compatibility
02d7a3b
BUG - actually fix numeric compatibilty check, with passing index tests
558e182
DOC - initial whatsnew
706f973
ENH - no longer consider category indexes containing different catego…
2ccab59
TST/CLN - no longer need new index_factory fixture and make code more…
c70f1c0
CLN - make code more readable
edb7e9c
CLN - pep8 adherence
84bfbda
Merge branch 'master' into enh/index_setops
aba75fe
DOC - fix whatsnew entry
fc9f138
BUG - chagne object dtype index construction
69cce99
Merge branch 'master' into enh/index_setops
fdfc7d7
CLN/BUG - clean according to failed pandas-dev style checks
42ca70e
CLN - fix imports with isort
5b25645
CLN - refactor tests and remove overriden public union methods
9b1ee7f
Merge branch 'master' into enh/index_setops
fdf9b71
CLN - make code more efficient and cleanup whatsnew
1de3cc8
Merge branch 'master' into enh/index_setops
8ed1093
DOC - fix ipython code block
77ca3a3
DOC - fix whatsnew code blocks again
5921038
CLN - clean up some code, tests and docs
3b94e3b
CLN - reorganize some code and add TODOs
fd4510e
CLN - remove trailing whitespace
ArtinSarraf 345eec1
Merge branch 'master' into enh/index_setops
265a7ee
Merge branch 'enh/index_setops' of https://github.com/ArtinSarraf/pan…
5de3d57
CLN - fix import order
6d82621
CLN - code cleanup, remove unneccesary operations
0af8a24
Merge branch 'master' into enh/index_setops
5a87715
CLN - apply error messages to both statements
a4f9e78
TST - add regex queries
c3c0caa
Merge branch 'master' into enh/index_setops
0bcbdf4
BUG - fix default sort arg
c410625
BUG - remove print
6bb054f
TST/DOC - move to new whatsnew and use local fixture for tests
aea731c
DOC - minor update to get tests to rerun
ArtinSarraf b5938fc
Merge branch 'master' into enh/index_setops
25452fc
Merge branch 'enh/index_setops' of https://github.com/ArtinSarraf/pan…
0b97a79
Merge branch 'master' into enh/index_setops
ArtinSarraf bf11c6f
Merge branch 'master' into enh/index_setops
6fd941d
Merge branch 'enh/index_setops' of https://github.com/ArtinSarraf/pan…
32037b5
DOC - fix docstrings and whatsnew
8870006
Merge branch 'master' into enh/index_setops
1d12bc9
DOC - update docstring
92f6707
TST - use tm.assert_index_equal
fbf3242
Merge branch 'master' into enh/index_setops
38d9f74
TST - parametrize union tests
b9e7b18
Merge branch 'master' into enh/index_setops
69aaa93
DOC - add docstring
b57160a
Merge branch 'master' into enh/index_setops
daa1287
Merge branch 'master' into enh/index_setops
54898c1
CLN/TST - fix super method calls and add error msg
fa839a9
TST - add Timestamp to regexand fix import sorting
a36f475
CLN - minor style updates
b840f49
Merge branch 'master' into enh/index_setops
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -470,7 +470,7 @@ def _extended_gcd(self, a, b): | |
| old_t, t = t, old_t - quotient * t | ||
| return old_r, old_s, old_t | ||
|
|
||
| def union(self, other, sort=None): | ||
| def _union(self, other, sort): | ||
| """ | ||
| Form the union of two Index objects and sorts if possible | ||
|
|
||
|
|
@@ -490,9 +490,8 @@ def union(self, other, sort=None): | |
| ------- | ||
| union : Index | ||
| """ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this needed any longer?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see related comment in DatetimeIndex module |
||
| self._assert_can_do_setop(other) | ||
| if len(other) == 0 or self.equals(other) or len(self) == 0: | ||
| return super().union(other, sort=sort) | ||
| if not len(other) or self.equals(other) or not len(self): | ||
| return super()._union(other, sort=sort) | ||
|
|
||
| if isinstance(other, RangeIndex) and sort is None: | ||
| start_s, step_s = self._start, self._step | ||
|
|
@@ -530,8 +529,7 @@ def union(self, other, sort=None): | |
| (start_s + step_o >= start_o) and | ||
| (end_s - step_o <= end_o)): | ||
| return RangeIndex(start_r, end_r + step_o, step_o) | ||
|
|
||
| return self._int64index.union(other, sort=sort) | ||
| return self._int64index._union(other, sort=sort) | ||
|
|
||
| @Appender(_index_shared_docs['join']) | ||
| def join(self, other, how='left', level=None, return_indexers=False, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.