From 3a44fc393e7d3423071cf8fc35f627845cffaac0 Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Sat, 31 Aug 2024 12:31:53 +0530 Subject: [PATCH] DOC: fix PR01,ES01 for pandas.Series.cat.as_unordered --- ci/code_checks.sh | 1 - pandas/core/arrays/categorical.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 2f95367266a36..cb58a237d6770 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -84,7 +84,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.RangeIndex.stop SA01" \ -i "pandas.Series.cat.add_categories PR01,PR02" \ -i "pandas.Series.cat.as_ordered PR01" \ - -i "pandas.Series.cat.as_unordered PR01" \ -i "pandas.Series.cat.remove_categories PR01,PR02" \ -i "pandas.Series.cat.remove_unused_categories PR01" \ -i "pandas.Series.cat.rename_categories PR01,PR02" \ diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index c613a345686cc..10b4329c1d486 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -1008,6 +1008,18 @@ def as_unordered(self) -> Self: """ Set the Categorical to be unordered. + This method sets the `ordered` attribute of the Categorical to `False`. + An unordered Categorical does not have any meaningful ordering among + its categories, which can be useful when the order of the categories + is not relevant for analysis or visualization. + + Parameters + ---------- + *args : iterable, optional + Positional arguments passed into `func`. + **kwargs : dict, optional + A dictionary of keyword arguments passed into `func`. + Returns ------- Categorical