-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Closed
Labels
Output-Formatting__repr__ of pandas objects, to_string__repr__ of pandas objects, to_string
Description
The count with groupby gives the number of entries while nunique gives the number of unique entries. The problem is that we get an additional column
>>> df = pd.DataFrame({"A": [0,0,1,1,0], "B": [1,2,3,4,5]})
>>> df.groupby("A").count()
B
A
0 3
1 2
>>> df.groupby("A").nunique()
A B
A
0 1 3
1 1 2
Why is the A column being added in nunique output?
Metadata
Metadata
Assignees
Labels
Output-Formatting__repr__ of pandas objects, to_string__repr__ of pandas objects, to_string