Skip to content

DOC: Fixing EX01 - Added examples #54266

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

Merged
merged 2 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
MSG='Partially validate docstrings (EX01)' ; echo $MSG
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX01 --ignore_functions \
pandas.errors.IncompatibilityWarning \
pandas.errors.NoBufferPresent \
pandas.errors.OptionError \
pandas.errors.PerformanceWarning \
pandas.errors.PyperclipException \
Expand All @@ -78,13 +77,14 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas.io.stata.StataWriter.write_file \
pandas.plotting.deregister_matplotlib_converters \
pandas.plotting.register_matplotlib_converters \
pandas.api.indexers.BaseIndexer \
pandas.api.indexers.VariableOffsetWindowIndexer \
pandas.util.hash_array \
pandas.util.hash_pandas_object \
pandas_object \
pandas.api.extensions.ExtensionDtype \
pandas.api.extensions.ExtensionArray \
pandas.arrays.NumpyExtensionArray \
pandas.api.extensions.ExtensionArray._concat_same_type \
pandas.api.extensions.ExtensionArray._formatter \
pandas.api.extensions.ExtensionArray._from_factorized \
pandas.api.extensions.ExtensionArray._from_sequence \
Expand All @@ -93,7 +93,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas.api.extensions.ExtensionArray._reduce \
pandas.api.extensions.ExtensionArray._values_for_factorize \
pandas.api.extensions.ExtensionArray.interpolate \
pandas.api.extensions.ExtensionArray.ravel \
RET=$(($RET + $?)) ; echo $MSG "DONE"

fi
Expand Down
16 changes: 16 additions & 0 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,13 @@ def ravel(self, order: Literal["C", "F", "A", "K"] | None = "C") -> ExtensionArr
-----
- Because ExtensionArrays are 1D-only, this is a no-op.
- The "order" argument is ignored, is for compatibility with NumPy.

Examples
--------
>>> pd.array([1, 2, 3]).ravel()
<IntegerArray>
[1, 2, 3]
Length: 3, dtype: Int64
"""
return self

Expand All @@ -1580,6 +1587,15 @@ def _concat_same_type(cls, to_concat: Sequence[Self]) -> Self:
Returns
-------
ExtensionArray

Examples
--------
>>> arr1 = pd.array([1, 2, 3])
>>> arr2 = pd.array([4, 5, 6])
>>> pd.arrays.IntegerArray._concat_same_type([arr1, arr2])
<IntegerArray>
[1, 2, 3, 4, 5, 6]
Length: 6, dtype: Int64
"""
# Implementer note: this method will only be called with a sequence of
# ExtensionArrays of this class and with the same dtype as self. This
Expand Down
14 changes: 14 additions & 0 deletions pandas/core/util/hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ def hash_pandas_object(
Returns
-------
Series of uint64, same length as the object

Examples
--------
>>> pd.util.hash_pandas_object(pd.Series([1, 2, 3]))
0 14639053686158035780
1 3869563279212530728
2 393322362522515241
dtype: uint64
"""
from pandas import Series

Expand Down Expand Up @@ -246,6 +254,12 @@ def hash_array(
-------
ndarray[np.uint64, ndim=1]
Hashed values, same length as the vals.

Examples
--------
>>> pd.util.hash_array(np.array([1, 2, 3]))
array([ 6238072747940578789, 15839785061582574730, 2185194620014831856],
dtype=uint64)
"""
if not hasattr(vals, "dtype"):
raise TypeError("must pass a ndarray-like")
Expand Down
1 change: 1 addition & 0 deletions scripts/validate_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"Styler.loader",
"errors.InvalidComparison",
"errors.LossySetitemError",
"errors.NoBufferPresent",
}
PRIVATE_CLASSES = ["NDFrame", "IndexOpsMixin"]
ERROR_MSGS = {
Expand Down