-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: dont consolidate in reshape.concat #34683
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
jreback
merged 19 commits into
pandas-dev:master
from
jbrockmendel:cln-consolidate-concat
Dec 17, 2020
Merged
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
64e9692
CLN: dont consolidate in reshape.concat
jbrockmendel 9251046
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel a5ea5e7
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel 53ee564
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel 562aa9c
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel 5f6d062
PERF: optimizations for concat
jbrockmendel e5d0218
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel 1c69c93
PERF: fastpaths
jbrockmendel 2558233
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel 2b5717c
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel 0b6ded7
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel 5823a67
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel 19dace8
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel 1911951
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel 3e7c2b5
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel fe8bec7
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel feff1ae
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel 6ed6c28
Merge branch 'master' of https://github.com/pandas-dev/pandas into cl…
jbrockmendel 55637ad
use isinstance check
jbrockmendel 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
import numpy as np | ||
|
||
from pandas._typing import FrameOrSeries, FrameOrSeriesUnion, Label | ||
from pandas.util._decorators import cache_readonly | ||
|
||
from pandas.core.dtypes.concat import concat_compat | ||
from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries | ||
|
@@ -349,7 +350,7 @@ def __init__( | |
if len(objs) == 0: | ||
raise ValueError("All objects passed were None") | ||
|
||
# consolidate data & figure out what our result ndim is going to be | ||
# figure out what our result ndim is going to be | ||
ndims = set() | ||
for obj in objs: | ||
if not isinstance(obj, (ABCSeries, ABCDataFrame)): | ||
|
@@ -359,8 +360,6 @@ def __init__( | |
) | ||
raise TypeError(msg) | ||
|
||
# consolidate | ||
obj._consolidate_inplace() | ||
ndims.add(obj.ndim) | ||
|
||
# get the sample | ||
|
@@ -518,7 +517,7 @@ def _get_result_dim(self) -> int: | |
def _get_new_axes(self) -> List[Index]: | ||
ndim = self._get_result_dim() | ||
return [ | ||
self._get_concat_axis() if i == self.bm_axis else self._get_comb_axis(i) | ||
self._get_concat_axis if i == self.bm_axis else self._get_comb_axis(i) | ||
for i in range(ndim) | ||
] | ||
|
||
|
@@ -532,6 +531,7 @@ def _get_comb_axis(self, i: int) -> Index: | |
copy=self.copy, | ||
) | ||
|
||
@cache_readonly | ||
def _get_concat_axis(self) -> Index: | ||
Comment on lines
+559
to
560
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. If it is property, then maybe |
||
""" | ||
Return index to be used along concatenation axis. | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not
is Categorical
? e.g. since we are removing comparison vs 'category' generally (in your other PR)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could do
isinstance(dtype, CategoricalDtype)
. either way is fine by meThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think prefer that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated+green