-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: Fixing SA04 errors as per #25337 #25354
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
Changes from all commits
6098e69
1baa2e9
eddb923
307c33f
7ca1fa4
4566a5f
f942d56
763a983
21c2ecb
e84a432
cde3b51
af7d2f9
a9b7c8a
073e345
87841b0
08f312c
6572d5f
9571487
55ab7e8
bcfc295
446ecc8
2867e13
517b158
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,8 +171,10 @@ def _from_factorized(cls, values, original): | |
|
||
See Also | ||
-------- | ||
pandas.factorize | ||
ExtensionArray.factorize | ||
pandas.factorize: Encode the object as an enumerated type or | ||
categorical variable. | ||
ExtensionArray.factorize: Encode the extension array as | ||
an enumerated type. | ||
""" | ||
raise AbstractMethodError(cls) | ||
|
||
|
@@ -377,7 +379,7 @@ def _values_for_argsort(self): | |
|
||
See Also | ||
-------- | ||
ExtensionArray.argsort | ||
ExtensionArray.argsort: Return the indices that would sort this array. | ||
""" | ||
# Note: this is used in `ExtensionArray.argsort`. | ||
return np.array(self) | ||
|
@@ -403,7 +405,7 @@ def argsort(self, ascending=True, kind='quicksort', *args, **kwargs): | |
|
||
See Also | ||
-------- | ||
numpy.argsort : Sorting implementation used internally. | ||
numpy.argsort : Sort implementation used internally. | ||
""" | ||
# Implementor note: You have two places to override the behavior of | ||
# argsort. | ||
|
@@ -647,7 +649,7 @@ def factorize(self, na_sentinel=-1): | |
|
||
See Also | ||
-------- | ||
pandas.factorize : Top-level factorize method that dispatches here. | ||
pandas.factorize: Top-level factorize method that dispatches here. | ||
|
||
Notes | ||
----- | ||
|
@@ -776,8 +778,8 @@ def take(self, indices, allow_fill=False, fill_value=None): | |
|
||
See Also | ||
-------- | ||
numpy.take | ||
pandas.api.extensions.take | ||
numpy.take: Take elements from an array along an axis. | ||
pandas.api.extensions.take: Take elements from an array. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. array -> ExtensionArray |
||
|
||
Examples | ||
-------- | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,8 +276,8 @@ class Categorical(ExtensionArray, PandasObject): | |
|
||
See Also | ||
-------- | ||
api.types.CategoricalDtype : Type for categorical data. | ||
CategoricalIndex : An Index with an underlying ``Categorical``. | ||
api.types.CategoricalDtype: Type for categorical data. | ||
CategoricalIndex: An Index with an underlying ``Categorical``. | ||
|
||
Notes | ||
----- | ||
|
@@ -421,12 +421,12 @@ def categories(self): | |
|
||
See Also | ||
-------- | ||
rename_categories | ||
reorder_categories | ||
add_categories | ||
remove_categories | ||
remove_unused_categories | ||
set_categories | ||
rename_categories: Rename categories. | ||
reorder_categories: Reorder categories into specified new categories. | ||
add_categories: Add new categories. | ||
remove_categories: Remove specified categories. | ||
remove_unused_categories: Remove unused categories. | ||
set_categories: Set new categories inplace. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove inplace |
||
""" | ||
return self.dtype.categories | ||
|
||
|
@@ -836,11 +836,11 @@ def set_categories(self, new_categories, ordered=None, rename=False, | |
|
||
See Also | ||
-------- | ||
rename_categories | ||
reorder_categories | ||
add_categories | ||
remove_categories | ||
remove_unused_categories | ||
rename_categories: Rename categories. | ||
reorder_categories: Reorder categories into specified new categories. | ||
add_categories: Add new categories. | ||
remove_categories: Remove specified categories. | ||
remove_unused_categorie: Remove unused categories. | ||
""" | ||
inplace = validate_bool_kwarg(inplace, 'inplace') | ||
if ordered is None: | ||
|
@@ -908,11 +908,11 @@ def rename_categories(self, new_categories, inplace=False): | |
|
||
See Also | ||
-------- | ||
reorder_categories | ||
add_categories | ||
remove_categories | ||
remove_unused_categories | ||
set_categories | ||
reorder_categories: Reorder categories into specified new categories. | ||
add_categories: Add new categories. | ||
remove_categories: Remove specified categories. | ||
remove_unused_categories: Remove unused categories. | ||
set_categories: Set new categories inplace. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove inplace and same for others |
||
|
||
Examples | ||
-------- | ||
|
@@ -986,11 +986,11 @@ def reorder_categories(self, new_categories, ordered=None, inplace=False): | |
|
||
See Also | ||
-------- | ||
rename_categories | ||
add_categories | ||
remove_categories | ||
remove_unused_categories | ||
set_categories | ||
rename_categories: Rename categories. | ||
add_categories: Add new categories. | ||
remove_categories: Remove specified categories. | ||
remove_unused_categories: Remove unused categories. | ||
set_categories: Set new categories inplace. | ||
""" | ||
inplace = validate_bool_kwarg(inplace, 'inplace') | ||
if set(self.dtype.categories) != set(new_categories): | ||
|
@@ -1026,11 +1026,11 @@ def add_categories(self, new_categories, inplace=False): | |
|
||
See Also | ||
-------- | ||
rename_categories | ||
reorder_categories | ||
remove_categories | ||
remove_unused_categories | ||
set_categories | ||
rename_categories: Rename categories. | ||
reorder_categories: Reorder categories into specified new categories. | ||
remove_categories: Remove specified categories. | ||
remove_unused_categories: Remove unused categories. | ||
set_categories: Set new categories inplace. | ||
""" | ||
inplace = validate_bool_kwarg(inplace, 'inplace') | ||
if not is_list_like(new_categories): | ||
|
@@ -1075,11 +1075,11 @@ def remove_categories(self, removals, inplace=False): | |
|
||
See Also | ||
-------- | ||
rename_categories | ||
reorder_categories | ||
add_categories | ||
remove_unused_categories | ||
set_categories | ||
rename_categories: Rename categories. | ||
reorder_categories: Reorder categories into specified new categories. | ||
add_categories: Add new categories. | ||
remove_unused_categories: Remove unused categories. | ||
set_categories: Set new categories inplace. | ||
""" | ||
inplace = validate_bool_kwarg(inplace, 'inplace') | ||
if not is_list_like(removals): | ||
|
@@ -1118,11 +1118,11 @@ def remove_unused_categories(self, inplace=False): | |
|
||
See Also | ||
-------- | ||
rename_categories | ||
reorder_categories | ||
add_categories | ||
remove_categories | ||
set_categories | ||
rename_categories: Rename categories. | ||
reorder_categories: Reorders categories into specified new categories. | ||
add_categories: Add new categories. | ||
remove_categories: Remove specified categories. | ||
set_categories: Set new categories inplace. | ||
""" | ||
inplace = validate_bool_kwarg(inplace, 'inplace') | ||
cat = self if inplace else self.copy() | ||
|
@@ -1366,7 +1366,8 @@ def memory_usage(self, deep=False): | |
|
||
See Also | ||
-------- | ||
numpy.ndarray.nbytes | ||
numpy.ndarray.nbytes: Total bytes consumed by the elements of the | ||
array. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. array -> numpy array |
||
""" | ||
return self._codes.nbytes + self.dtype.categories.memory_usage( | ||
deep=deep) | ||
|
@@ -1403,7 +1404,6 @@ def isna(self): | |
isna : Top-level isna. | ||
isnull : Alias of isna. | ||
Categorical.notna : Boolean inverse of Categorical.isna. | ||
|
||
""" | ||
|
||
ret = self._codes == -1 | ||
|
@@ -1423,10 +1423,9 @@ def notna(self): | |
|
||
See Also | ||
-------- | ||
notna : Top-level notna. | ||
notnull : Alias of notna. | ||
Categorical.isna : Boolean inverse of Categorical.notna. | ||
|
||
notna: Top-level notna. | ||
notnull: Alias of notna. | ||
Categorical.isna: Boolean inverse of Categorical.notna. | ||
""" | ||
return ~self.isna() | ||
notnull = notna | ||
|
@@ -1469,8 +1468,8 @@ def value_counts(self, dropna=True): | |
|
||
See Also | ||
-------- | ||
Series.value_counts | ||
|
||
Series.value_counts: Return a Series containing counts of unique | ||
values. | ||
""" | ||
from numpy import bincount | ||
from pandas import Series, CategoricalIndex | ||
|
@@ -1544,7 +1543,7 @@ def argsort(self, *args, **kwargs): | |
|
||
See Also | ||
-------- | ||
numpy.ndarray.argsort | ||
numpy.ndarray.argsort: Return the indices that would sort this array. | ||
|
||
Notes | ||
----- | ||
|
@@ -1597,8 +1596,9 @@ def sort_values(self, inplace=False, ascending=True, na_position='last'): | |
|
||
See Also | ||
-------- | ||
Categorical.sort | ||
Series.sort_values | ||
Categorical.sort: Sort the Category inplace by category value. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove inplace |
||
Series.sort_values: Sort a Series in ascending or descending | ||
order by some criterion. | ||
|
||
Examples | ||
-------- | ||
|
@@ -1845,8 +1845,8 @@ def take_nd(self, indexer, allow_fill=None, fill_value=None): | |
|
||
See Also | ||
-------- | ||
Series.take : Similar method for Series. | ||
numpy.ndarray.take : Similar method for NumPy arrays. | ||
Series.take: Similar method for Series. | ||
numpy.ndarray.take: Similar method for NumPy arrays. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. be consistent, either use NumPy of numpy in your edits |
||
|
||
Examples | ||
-------- | ||
|
@@ -2294,9 +2294,12 @@ def unique(self): | |
|
||
See Also | ||
-------- | ||
unique | ||
CategoricalIndex.unique | ||
Series.unique | ||
unique: Hash table-based unique. Uniques are returned in order of | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove Hash table-based unique There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. say the order of the original is preserved (rather than does not sort) |
||
appearance. This does NOT sort. | ||
CategoricalIndex.unique: Return Index of unique values in the object. | ||
Includes NA values. The order of the original is preserved. | ||
Series.unique: Return Index of unique values in the object. Includes | ||
NA values. The order of the original is preserved. | ||
|
||
""" | ||
|
||
|
@@ -2427,7 +2430,7 @@ def isin(self, values): | |
|
||
See Also | ||
-------- | ||
pandas.Series.isin : Equivalent method on Series. | ||
pandas.Series.isin: Equivalent method on Series. | ||
|
||
Examples | ||
-------- | ||
|
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 remove the extra line