-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DEPR: concat ignoring empty objects #52532
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
Changes from 18 commits
63292d4
2ace79c
6258adf
bfd969f
51e6d36
52ce0d7
f8dc81e
163bf8a
03a0641
49a7146
7e2e995
7c0c715
7f2977a
0eaf359
a878fea
75d5041
9e2de8f
392b40a
465c141
3666bca
390d4ef
aa5794f
1277b26
5cddae9
8e58bff
47a17b3
e696c53
7f07121
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -475,7 +475,9 @@ def is_na(self) -> bool: | |
|
||
values = blk.values | ||
if values.size == 0: | ||
# GH#39122 this case will return False once deprecation is enforced | ||
return True | ||
|
||
if isinstance(values.dtype, SparseDtype): | ||
return False | ||
|
||
|
@@ -494,16 +496,14 @@ def is_na(self) -> bool: | |
return all(isna_all(row) for row in values) | ||
|
||
@cache_readonly | ||
def is_na_without_isna_all(self) -> bool: | ||
def is_na_after_size_and_isna_all_deprecation(self) -> bool: | ||
""" | ||
Will self.is_na be True after values.size == 0 deprecation and isna_all | ||
deprecation are enforced? | ||
""" | ||
blk = self.block | ||
if blk.dtype.kind == "V": | ||
return True | ||
if not blk._can_hold_na: | ||
return False | ||
|
||
values = blk.values | ||
if values.size == 0: | ||
return True | ||
Comment on lines
-409
to
-418
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. why does this change? 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. Because the future behavior won't depend on 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. sure but the deprecation hasn't been enforced yet, why is this changing already? 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. this method is for checking on the future behavior to see if we need to issue a warning. |
||
return False | ||
|
||
def get_reindexed_values(self, empty_dtype: DtypeObj, upcasted_na) -> ArrayLike: | ||
|
@@ -565,17 +565,16 @@ def _concatenate_join_units(join_units: list[JoinUnit], copy: bool) -> ArrayLike | |
|
||
if empty_dtype != empty_dtype_future: | ||
if empty_dtype == concat_values.dtype: | ||
# GH#40893 | ||
# GH#39122, GH#40893 | ||
warnings.warn( | ||
"The behavior of DataFrame concatenation with all-NA entries is " | ||
"deprecated. In a future version, this will no longer exclude " | ||
"all-NA columns when determining the result dtypes. " | ||
"To retain the old behavior, cast the all-NA columns to the " | ||
"desired dtype before the concat operation.", | ||
"The behavior of DataFrame concatenation with empty or all-NA " | ||
"entries is deprecated. In a future version, this will no longer " | ||
"exclude empty or all-NA columns when determining the result dtypes. " | ||
"To retain the old behavior, exclude the relevant entries before " | ||
"the concat operation.", | ||
FutureWarning, | ||
stacklevel=find_stack_level(), | ||
) | ||
|
||
return concat_values | ||
|
||
|
||
|
@@ -631,7 +630,9 @@ def _get_empty_dtype(join_units: Sequence[JoinUnit]) -> tuple[DtypeObj, DtypeObj | |
dtype_future = dtype | ||
if len(dtypes) != len(join_units): | ||
dtypes_future = [ | ||
unit.block.dtype for unit in join_units if not unit.is_na_without_isna_all | ||
unit.block.dtype | ||
for unit in join_units | ||
if not unit.is_na_after_size_and_isna_all_deprecation | ||
] | ||
if not len(dtypes_future): | ||
dtypes_future = [ | ||
|
Uh oh!
There was an error while loading. Please reload this page.