-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
DOC: Explicitly include "private" ExtensionArray methods in API docs #27279
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
ab4879b
4db99f1
e8c5df7
45d70bb
016289d
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 |
---|---|---|
|
@@ -39,6 +39,39 @@ class ExtensionArray: | |
|
||
.. versionadded:: 0.23.0 | ||
|
||
Attributes | ||
---------- | ||
dtype | ||
nbytes | ||
ndim | ||
shape | ||
|
||
Methods | ||
------- | ||
argsort | ||
astype | ||
copy | ||
dropna | ||
factorize | ||
fillna | ||
isna | ||
ravel | ||
repeat | ||
searchsorted | ||
shift | ||
take | ||
unique | ||
_concat_same_type | ||
_formatter | ||
_formatting_values | ||
_from_factorized | ||
_from_sequence | ||
_from_sequence_of_strings | ||
_ndarray_values | ||
_reduce | ||
_values_for_argsort | ||
_values_for_factorize | ||
|
||
Notes | ||
----- | ||
The interface includes the following abstract methods that must be | ||
|
@@ -170,7 +203,6 @@ def _from_sequence_of_strings(cls, strings, dtype=None, copy=False): | |
Returns | ||
------- | ||
ExtensionArray | ||
|
||
""" | ||
raise AbstractMethodError(cls) | ||
|
||
|
@@ -188,7 +220,7 @@ def _from_factorized(cls, values, original): | |
|
||
See Also | ||
-------- | ||
pandas.factorize | ||
factorize | ||
ExtensionArray.factorize | ||
""" | ||
raise AbstractMethodError(cls) | ||
|
@@ -654,7 +686,7 @@ def factorize(self, na_sentinel: int = -1) -> Tuple[np.ndarray, ABCExtensionArra | |
|
||
See Also | ||
-------- | ||
pandas.factorize : Top-level factorize method that dispatches here. | ||
factorize : Top-level factorize method that dispatches here. | ||
|
||
Notes | ||
----- | ||
|
@@ -778,18 +810,18 @@ def take( | |
When `indices` contains negative values other than ``-1`` | ||
and `allow_fill` is True. | ||
|
||
See Also | ||
-------- | ||
numpy.take | ||
api.extensions.take | ||
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. Can you leave the 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. @jorisvandenbossche
What do you recommend to do? 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. I dislike this listing rule in this case. I believe it's to ensure we consistently do things like But I think the (redundant) namespacing here is helpful here since I wouldn't immediately associate Regardless, for now we can just please the linter. |
||
|
||
Notes | ||
----- | ||
ExtensionArray.take is called by ``Series.__getitem__``, ``.loc``, | ||
``iloc``, when `indices` is a sequence of values. Additionally, | ||
it's called by :meth:`Series.reindex`, or any other method | ||
that causes realignment, with a `fill_value`. | ||
|
||
See Also | ||
-------- | ||
numpy.take | ||
pandas.api.extensions.take | ||
|
||
Examples | ||
-------- | ||
Here's an example implementation, which relies on casting the | ||
|
@@ -862,7 +894,7 @@ def _formatter(self, boxed: bool = False) -> Callable[[Any], Optional[str]]: | |
|
||
Parameters | ||
---------- | ||
boxed: bool, default False | ||
boxed : bool, default False | ||
An indicated for whether or not your array is being printed | ||
within a Series, DataFrame, or Index (True), or just by | ||
itself (False). This may be useful if you want scalar values | ||
|
@@ -889,6 +921,10 @@ def _formatting_values(self) -> np.ndarray: | |
.. deprecated:: 0.24.0 | ||
|
||
Use :meth:`ExtensionArray._formatter` instead. | ||
|
||
Returns | ||
------- | ||
array : ndarray | ||
""" | ||
return np.array(self) | ||
|
||
|
@@ -904,6 +940,10 @@ def ravel(self, order="C") -> ABCExtensionArray: | |
---------- | ||
order : {None, 'C', 'F', 'A', 'K'}, default 'C' | ||
|
||
Returns | ||
------- | ||
ExtensionArray | ||
|
||
Notes | ||
----- | ||
- Because ExtensionArrays are 1D-only, this is a no-op. | ||
|
@@ -944,6 +984,10 @@ def _ndarray_values(self) -> np.ndarray: | |
|
||
The expectation is that this is cheap to compute, and is primarily | ||
used for interacting with our indexers. | ||
|
||
Returns | ||
------- | ||
array : ndarray | ||
""" | ||
return np.array(self) | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.