-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DataFrame.nunique is incorrect for DataFrame with no columns #21959
Comments
@streamnsight : That indeed bothers me too. Patch is welcome! What is the latest version where this example fails (i.e. does it break after |
@gfyoung it seems to work until 0.22 |
Ah, so this broke in |
@gfyoung @TomAugspurger |
We'll use this issue specifically for nunique so that we can close it when
it's fixed and tested.
If there aren't already open issues for any other bugs you noticed, please
open a new issue.
…On Thu, Jul 19, 2018 at 11:24 AM Emmanuel ***@***.***> wrote:
@gfyoung <https://github.com/gfyoung> @TomAugspurger
<https://github.com/TomAugspurger>
As I pointed out in the original post, I believe this is wider than just a
problem with nunique as when I was looking for similar issues, I found a
few posts about issues with empty Series / DataFrames. So IMO it is an
issue with the way index is managed for an empty Series / DataFrame.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#21959 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHIs3OH92s2QnQQ8GWQlIvjn0MBTwBks5uILK1gaJpZM4VT0Od>
.
|
git bisect leads me to 76b35c6, but it's quite hard to tell. The underlying issue talks about indexing
Might be a false lead, but it's just what git bisect gave me when running
|
(edit by @TomAugspurger)
Current output:
Expected Output is an empty series:
Not sure what the expected dtype of that Series should be... probably object.
original post below:
Code Sample, a copy-pastable example if possible
With Pandas 0.20.3
With pandas 0.23.3
Note:
Problem description
The change of behavior is a bit disturbing, and seems like it is a bug:
nunique()
ends up creating a Series, and it should be a Series of the df columns, but that doesn't seem to be the case here, instead it is picking up the index of the df.This is likely related to:
#21932
#21255
I am posting this because in my use case I use the list to drop the columns, but i end up with column names that do not exist in the df
The text was updated successfully, but these errors were encountered: