diff --git a/ci/code_checks.sh b/ci/code_checks.sh index dd9219f03abca..6ec41a153dc7d 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -63,7 +63,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.PerformanceWarning \ pandas.errors.PyperclipException \ pandas.errors.PyperclipWindowsException \ pandas.errors.UnsortedIndexError \ diff --git a/pandas/errors/__init__.py b/pandas/errors/__init__.py index 71e12109292ae..a7d113094543d 100644 --- a/pandas/errors/__init__.py +++ b/pandas/errors/__init__.py @@ -46,6 +46,26 @@ class NullFrequencyError(ValueError): class PerformanceWarning(Warning): """ Warning raised when there is a possible performance impact. + + Examples + -------- + >>> df = pd.DataFrame({"jim": [0, 0, 1, 1], + ... "joe": ["x", "x", "z", "y"], + ... "jolie": [1, 2, 3, 4]}) + >>> df = df.set_index(["jim", "joe"]) + >>> df + jolie + jim joe + 0 x 1 + x 2 + 1 z 3 + y 4 + >>> df.loc[(1, 'z')] # doctest: +SKIP + # PerformanceWarning: indexing past lexsort depth may impact performance. + df.loc[(1, 'z')] + jolie + jim joe + 1 z 3 """