Skip to content

Commit

Permalink
DOC: Fix docstrings for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sunlight798 committed Dec 8, 2024
1 parent 8a286fa commit 1f3dce4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
3 changes: 0 additions & 3 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.core.resample.Resampler.std SA01" \
-i "pandas.core.resample.Resampler.transform PR01,RT03,SA01" \
-i "pandas.core.resample.Resampler.var SA01" \
-i "pandas.errors.NullFrequencyError SA01" \
-i "pandas.errors.NumbaUtilError SA01" \
-i "pandas.errors.PerformanceWarning SA01" \
-i "pandas.errors.UndefinedVariableError PR01,SA01" \
-i "pandas.errors.ValueLabelTypeMismatch SA01" \
-i "pandas.io.json.build_table_schema PR07,RT03,SA01" \
Expand Down
22 changes: 20 additions & 2 deletions pandas/errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ class NullFrequencyError(ValueError):
Particularly ``DatetimeIndex.shift``, ``TimedeltaIndex.shift``,
``PeriodIndex.shift``.
See Also
--------
Index.shift : Shift values of Index.
Series.shift : Shift values of Series.
Examples
--------
>>> df = pd.DatetimeIndex(["2011-01-01 10:00", "2011-01-01"], freq=None)
Expand All @@ -58,6 +63,12 @@ class PerformanceWarning(Warning):
"""
Warning raised when there is a possible performance impact.
See Also
--------
DataFrame.set_index : Set the DataFrame index using existing columns.
DataFrame.loc : Access a group of rows and columns by label(s) \
or a boolean array.
Examples
--------
>>> df = pd.DataFrame(
Expand Down Expand Up @@ -385,17 +396,24 @@ class NumbaUtilError(Exception):
"""
Error raised for unsupported Numba engine routines.
See Also
--------
DataFrame.groupby : Group DataFrame using a mapper or by a Series of columns.
Series.groupby : Group Series using a mapper or by a Series of columns.
DataFrame.agg : Aggregate using one or more operations over the specified axis.
Series.agg : Aggregate using one or more operations over the specified axis.
Examples
--------
>>> df = pd.DataFrame(
... {"key": ["a", "a", "b", "b"], "data": [1, 2, 3, 4]}, columns=["key", "data"]
... )
>>> def incorrect_function(x):
... return sum(x) * 2.7
>>> df.groupby("key").agg(incorrect_function, engine="numba")
>>> df.("key").agg(incorrect_function, engine="numba")
Traceback (most recent call last):
NumbaUtilError: The first 2 arguments to incorrect_function
must be ['values', 'index']
must be ['values', 'index']groupby
"""


Expand Down

0 comments on commit 1f3dce4

Please sign in to comment.