Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
8 changes: 5 additions & 3 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Period.freq GL08" \
-i "pandas.Period.ordinal GL08" \
-i "pandas.errors.IncompatibleFrequency SA01,SS06,EX01" \
-i "pandas.errors.InvalidVersion GL08" \
-i "pandas.api.extensions.ExtensionArray.value_counts EX01,RT03,SA01" \
-i "pandas.core.groupby.DataFrameGroupBy.plot PR02" \
-i "pandas.core.groupby.SeriesGroupBy.plot PR02" \
-i "pandas.core.resample.Resampler.quantile PR01,PR07" \
-i "pandas.api.typing.DataFrameGroupBy.plot PR02" \
-i "pandas.api.typing.SeriesGroupBy.plot PR02" \
-i "pandas.api.typing.Resampler.quantile PR01,PR07" \
-i "pandas.arrays.NumpyExtensionArray GL08" \
-i "pandas.tseries.offsets.BDay PR02,SA01" \
-i "pandas.tseries.offsets.BHalfYearBegin.is_on_offset GL08" \
-i "pandas.tseries.offsets.BHalfYearBegin.n GL08" \
Expand Down
4 changes: 2 additions & 2 deletions doc/source/reference/groupby.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=======
GroupBy
=======
.. currentmodule:: pandas.core.groupby
.. currentmodule:: pandas.api.typing

:class:`pandas.api.typing.DataFrameGroupBy` and :class:`pandas.api.typing.SeriesGroupBy`
instances are returned by groupby calls :func:`pandas.DataFrame.groupby` and
Expand Down Expand Up @@ -40,7 +40,7 @@ Function application helper

NamedAgg

.. currentmodule:: pandas.core.groupby
.. currentmodule:: pandas.api.typing

Function application
--------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/source/reference/resampling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
==========
Resampling
==========
.. currentmodule:: pandas.core.resample
.. currentmodule:: pandas.api.typing

:class:`pandas.api.typing.Resampler` instances are returned by
resample calls: :func:`pandas.DataFrame.resample`, :func:`pandas.Series.resample`.
Expand Down
11 changes: 7 additions & 4 deletions doc/source/reference/window.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ calls: :func:`pandas.DataFrame.ewm` and :func:`pandas.Series.ewm`.

Rolling window functions
------------------------
.. currentmodule:: pandas.core.window.rolling
.. currentmodule:: pandas.api.typing

.. autosummary::
:toctree: api/
Expand Down Expand Up @@ -48,7 +48,8 @@ Rolling window functions

Weighted window functions
-------------------------
.. currentmodule:: pandas.core.window.rolling
.. currentmodule:: pandas.api.typing


.. autosummary::
:toctree: api/
Expand All @@ -62,7 +63,8 @@ Weighted window functions

Expanding window functions
--------------------------
.. currentmodule:: pandas.core.window.expanding
.. currentmodule:: pandas.api.typing


.. autosummary::
:toctree: api/
Expand Down Expand Up @@ -93,7 +95,8 @@ Expanding window functions

Exponentially-weighted window functions
---------------------------------------
.. currentmodule:: pandas.core.window.ewm
.. currentmodule:: pandas.api.typing


.. autosummary::
:toctree: api/
Expand Down
2 changes: 1 addition & 1 deletion doc/source/user_guide/enhancingperf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ by evaluate arithmetic and boolean expression all at once for large :class:`~pan
:func:`~pandas.eval` is many orders of magnitude slower for
smaller expressions or objects than plain Python. A good rule of thumb is
to only use :func:`~pandas.eval` when you have a
:class:`~pandas.core.frame.DataFrame` with more than 10,000 rows.
:class:`~pandas.DataFrame` with more than 10,000 rows.

Supported syntax
~~~~~~~~~~~~~~~~
Expand Down
8 changes: 7 additions & 1 deletion pandas/_config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class RegisteredOption(NamedTuple):


class OptionError(AttributeError, KeyError):
__module__ = "pandas.errors"
"""
Exception raised for pandas.options.

Expand All @@ -118,6 +117,8 @@ class OptionError(AttributeError, KeyError):
OptionError: No such option
"""

__module__ = "pandas.errors"


#
# User API
Expand Down Expand Up @@ -412,6 +413,10 @@ def __init__(self, d: dict[str, Any], prefix: str = "") -> None:
object.__setattr__(self, "prefix", prefix)

def __setattr__(self, key: str, val: Any) -> None:
if key == "__module__":
# Need to be able to set __module__ to pandas for pandas.options
super().__setattr__(key, val)
return
prefix = object.__getattribute__(self, "prefix")
if prefix:
prefix += "."
Expand Down Expand Up @@ -442,6 +447,7 @@ def __dir__(self) -> list[str]:


options = DictWrapper(_global_config)
options.__module__ = "pandas"

#
# Functions for use by pandas developers, in addition to User - api
Expand Down
2 changes: 2 additions & 0 deletions pandas/_libs/lib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2944,7 +2944,9 @@ class _NoDefault(Enum):

# Note: no_default is exported to the public API in pandas.api.extensions
no_default = _NoDefault.no_default # Sentinel indicating the default value.
no_default.__module__ = "pandas.api.extensions"
NoDefault = Literal[_NoDefault.no_default]
NoDefault.__module__ = "pandas.api.typing"


@cython.boundscheck(False)
Expand Down
1 change: 1 addition & 0 deletions pandas/_libs/missing.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -546,3 +546,4 @@ class NAType(C_NAType):

C_NA = NAType() # C-visible
NA = C_NA # Python-visible
NA.__module__ = "pandas"
1 change: 1 addition & 0 deletions pandas/_libs/tslibs/nattype.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1871,6 +1871,7 @@ default 'raise'

c_NaT = NaTType() # C-visible
NaT = c_NaT # Python-visible
NaT.__module__ = "pandas"


# ----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1627,11 +1627,11 @@ DIFFERENT_FREQ = ("Input has different freq={other_freq} "


class IncompatibleFrequency(TypeError):
__module__ = "pandas.errors"
"""
Raised when trying to compare or operate between Periods with different
frequencies.
"""
__module__ = "pandas.errors"
pass


Expand Down
12 changes: 6 additions & 6 deletions pandas/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@


class SequenceNotStr(Protocol[_T_co]):
__module__ = "pandas.api.typing.aliases"
__module__: str = "pandas.api.typing.aliases"

@overload
def __getitem__(self, index: SupportsIndex, /) -> _T_co: ...
Expand Down Expand Up @@ -280,15 +280,15 @@ def tell(self) -> int:


class ReadBuffer(BaseBuffer, Protocol[AnyStr_co]):
__module__ = "pandas.api.typing.aliases"
__module__: str = "pandas.api.typing.aliases"

def read(self, n: int = ..., /) -> AnyStr_co:
# for BytesIOWrapper, gzip.GzipFile, bz2.BZ2File
...


class WriteBuffer(BaseBuffer, Protocol[AnyStr_contra]):
__module__ = "pandas.api.typing.aliases"
__module__: str = "pandas.api.typing.aliases"

def write(self, b: AnyStr_contra, /) -> Any:
# for gzip.GzipFile, bz2.BZ2File
Expand All @@ -300,19 +300,19 @@ def flush(self) -> Any:


class ReadPickleBuffer(ReadBuffer[bytes], Protocol):
__module__ = "pandas.api.typing.aliases"
__module__: str = "pandas.api.typing.aliases"

def readline(self) -> bytes: ...


class WriteExcelBuffer(WriteBuffer[bytes], Protocol):
__module__ = "pandas.api.typing.aliases"
__module__: str = "pandas.api.typing.aliases"

def truncate(self, size: int | None = ..., /) -> int: ...


class ReadCsvBuffer(ReadBuffer[AnyStr_co], Protocol):
__module__ = "pandas.api.typing.aliases"
__module__: str = "pandas.api.typing.aliases"

def __iter__(self) -> Iterator[AnyStr_co]:
# for engine=python
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@


class BaseExecutionEngine(abc.ABC):
__module__ = "pandas.api.executors"
"""
Base class for execution engines for map and apply methods.

Expand All @@ -89,6 +88,8 @@ class BaseExecutionEngine(abc.ABC):
simply runs the code with the Python interpreter and pandas.
"""

__module__ = "pandas.api.executors"

@staticmethod
@abc.abstractmethod
def map(
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/arrays/arrow/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ class ArrowExtensionArray(
ExtensionArraySupportsAnyAll,
ArrowStringArrayMixin,
):
__module__ = "pandas.arrays"
"""
Pandas ExtensionArray backed by a PyArrow ChunkedArray.

Expand Down Expand Up @@ -297,6 +296,8 @@ class ArrowExtensionArray(
Length: 3, dtype: int64[pyarrow]
""" # noqa: E501 (http link too long)

__module__ = "pandas.arrays"

_pa_array: pa.ChunkedArray
_dtype: ArrowDtype

Expand Down
8 changes: 5 additions & 3 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@


class ExtensionArray:
__module__ = "pandas.api.extensions"
"""
Abstract base class for custom 1-D array types.

Expand Down Expand Up @@ -257,6 +256,8 @@ class ExtensionArray:
https://github.com/pandas-dev/pandas/blob/main/pandas/tests/extension/list/array.py
"""

__module__ = "pandas.api.extensions"

# '_typ' is for pandas.core.dtypes.generic.ABCExtensionArray.
# Don't override this.
_typ = "extension"
Expand Down Expand Up @@ -1807,7 +1808,7 @@ def take(
.. code-block:: python

def take(self, indices, allow_fill=False, fill_value=None):
from pandas.core.algorithms import take
from pandas.api.extensions import take

# If the ExtensionArray is backed by an ndarray, then
# just pass that here instead of coercing to object.
Expand Down Expand Up @@ -2788,7 +2789,6 @@ def _add_logical_ops(cls) -> None:


class ExtensionScalarOpsMixin(ExtensionOpsMixin):
__module__ = "pandas.api.extensions"
"""
A mixin for defining ops on an ExtensionArray.

Expand All @@ -2814,6 +2814,8 @@ class ExtensionScalarOpsMixin(ExtensionOpsMixin):
with NumPy arrays.
"""

__module__ = "pandas.api.extensions"

@classmethod
def _create_method(cls, op, coerce_to_dtype: bool = True, result_dtype=None):
"""
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/arrays/boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ def coerce_to_array(


class BooleanArray(BaseMaskedArray):
__module__ = "pandas.arrays"
"""
Array of boolean (True/False) data with missing values.

Expand Down Expand Up @@ -305,6 +304,8 @@ class BooleanArray(BaseMaskedArray):
Length: 3, dtype: boolean
"""

__module__ = "pandas.arrays"

_TRUE_VALUES = {"True", "TRUE", "true", "1", "1.0"}
_FALSE_VALUES = {"False", "FALSE", "false", "0", "0.0"}

Expand Down
3 changes: 2 additions & 1 deletion pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ def contains(cat, key, container) -> bool:


class Categorical(NDArrayBackedExtensionArray, PandasObject, ObjectStringArrayMixin):
__module__ = "pandas"
"""
Represent a categorical variable in classic R / S-plus fashion.

Expand Down Expand Up @@ -362,6 +361,8 @@ class Categorical(NDArrayBackedExtensionArray, PandasObject, ObjectStringArrayMi
'c'
"""

__module__ = "pandas"

# For comparisons, so that numpy uses our implementation if the compare
# ops, which raise
__array_priority__ = 1000
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ def f(self):


class DatetimeArray(dtl.TimelikeOps, dtl.DatelikeOps):
__module__ = "pandas.arrays"
"""
Pandas ExtensionArray for tz-naive or tz-aware datetime data.

Expand Down Expand Up @@ -224,6 +223,8 @@ class DatetimeArray(dtl.TimelikeOps, dtl.DatelikeOps):
Length: 2, dtype: datetime64[s]
"""

__module__ = "pandas.arrays"

_typ = "datetimearray"
_internal_fill_value = np.datetime64("NaT", "ns")
_recognized_scalars = (datetime, np.datetime64)
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/arrays/floating.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def _safe_cast(cls, values: np.ndarray, dtype: np.dtype, copy: bool) -> np.ndarr


class FloatingArray(NumericArray):
__module__ = "pandas.arrays"
"""
Array of floating (optional missing) values.

Expand Down Expand Up @@ -130,6 +129,8 @@ class FloatingArray(NumericArray):
Length: 3, dtype: Float32
"""

__module__ = "pandas.arrays"

_dtype_cls = FloatingDtype


Expand Down
3 changes: 2 additions & 1 deletion pandas/core/arrays/integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def _safe_cast(cls, values: np.ndarray, dtype: np.dtype, copy: bool) -> np.ndarr


class IntegerArray(NumericArray):
__module__ = "pandas.arrays"
"""
Array of integer (optional missing) values.

Expand Down Expand Up @@ -143,6 +142,8 @@ class IntegerArray(NumericArray):
Length: 3, dtype: UInt16
"""

__module__ = "pandas.arrays"

_dtype_cls = IntegerDtype


Expand Down
3 changes: 2 additions & 1 deletion pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@


class IntervalArray(IntervalMixin, ExtensionArray):
__module__ = "pandas.arrays"
"""
Pandas array for interval data that are closed on the same side.

Expand Down Expand Up @@ -244,6 +243,8 @@ class IntervalArray(IntervalMixin, ExtensionArray):
:meth:`IntervalArray.from_breaks`, and :meth:`IntervalArray.from_tuples`.
"""

__module__ = "pandas.arrays"

can_hold_na = True
_na_value = _fill_value = np.nan

Expand Down
Loading
Loading