-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Add doc for counting categorical dtype #59327
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
Conversation
jahn96
commented
Jul 26, 2024
- closes BUG (?): dtype.value_counts() shows categorical multiple times #40735
- All code checks passed.
|
||
.. ipython:: python | ||
|
||
df = pd.DataFrame({'a': [1], 'b': ['2'], 'c': [3], 'd': [3]}).astype({'a': 'category', 'c': 'category', 'd': 'category'}) |
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.
Can you put this in the docstring instead?
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.
addressed here
@@ -1178,3 +1180,9 @@ Use ``copy=True`` to prevent such a behaviour or simply don't reuse ``Categorica | |||
This also happens in some cases when you supply a NumPy array instead of a ``Categorical``: | |||
using an int array (e.g. ``np.array([1,2,3,4])``) will exhibit the same behavior, while using | |||
a string array (e.g. ``np.array(["a","b","c","a"])``) will not. | |||
|
|||
Counting CategoricalDtype |
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 you undo the changes in this file?
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.
Addressed here
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.
Looks like there's still changes in this file
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.
Ah sorry! Addressed here
pandas/core/base.py
Outdated
@@ -1049,6 +1049,34 @@ def value_counts( | |||
4.0 1 | |||
NaN 1 | |||
Name: count, dtype: int64 | |||
|
|||
**categorial_dtypes** |
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.
**categorial_dtypes** | |
**Categorial Dtypes** |
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.
Addressed here
Thanks @jahn96 |