-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: applymap on empty DataFrame returns Series (#8222) #14977
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
Conversation
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
Current coverage is 84.65% (diff: 100%)@@ master #14977 diff @@
==========================================
Files 144 144
Lines 51047 51049 +2
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43216 43218 +2
Misses 7831 7831
Partials 0 0
|
jreback
reviewed
Dec 24, 2016
@@ -284,7 +284,7 @@ Bug Fixes | |||
- Bug in ``DataFrame(..).apply(to_numeric)`` when values are of type decimal.Decimal. (:issue:`14827`) | |||
- Bug in ``describe()`` when passing a numpy array which does not contain the median to the ``percentiles`` keyword argument (:issue:`14908`) | |||
- Bug in ``DataFrame.sort_values()`` when sorting by multiple columns where one column is of type ``int64`` and contains ``NaT`` (:issue:`14922`) | |||
|
|||
- Bug in ``applymap()`` returning a ``Series`` with an empty ``DataFrame`` (:issue:`8222`) |
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.
move to API changes
jreback
reviewed
Dec 24, 2016
# GH 8222 | ||
empty_frames = [pd.DataFrame(), | ||
pd.DataFrame(columns=list('ABC')), | ||
pd.DataFrame(index=list('ABC'))] |
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.
add one with data as well
fix whatsnew file Adjust whatsnew to API change and add test with data
Changes made and all green. Thanks! |
thanks! |
ShaharBental
pushed a commit
to ShaharBental/pandas
that referenced
this pull request
Dec 26, 2016
…ndas-dev#14977) fix whatsnew file Adjust whatsnew to API change and add test with data
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
git diff upstream/master | flake8 --diff
Within
applymap
, the data is converted into a numpy array withasobject
here and evaluated with theapply
method_apply_empty_result
since this frame is empty. The numpy array is compared to anSeries
here which proceeds to get returned as aSeries
here.Found that passing in the data without using
asobject
allows the logic to return a copy of the empty dataframe here.