Skip to content
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
2 changes: 2 additions & 0 deletions pandas/io/clipboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import warnings

from pandas._libs import lib
from pandas.util._decorators import set_module
from pandas.util._exceptions import find_stack_level
from pandas.util._validators import check_dtype_backend

Expand All @@ -21,6 +22,7 @@
from pandas._typing import DtypeBackend


@set_module("pandas")
def read_clipboard(
sep: str = r"\s+",
dtype_backend: DtypeBackend | lib.NoDefault = lib.no_default,
Expand Down
4 changes: 4 additions & 0 deletions pandas/io/excel/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from pandas.util._decorators import (
Appender,
doc,
set_module,
)
from pandas.util._exceptions import find_stack_level
from pandas.util._validators import check_dtype_backend
Expand Down Expand Up @@ -434,6 +435,7 @@ def read_excel(
) -> dict[IntStrT, DataFrame]: ...


@set_module("pandas")
@doc(storage_options=_shared_docs["storage_options"])
@Appender(_read_excel_doc)
def read_excel(
Expand Down Expand Up @@ -951,6 +953,7 @@ def _parse_sheet(
return output


@set_module("pandas")
@doc(storage_options=_shared_docs["storage_options"])
class ExcelWriter(Generic[_WorkbookT]):
"""
Expand Down Expand Up @@ -1471,6 +1474,7 @@ def inspect_excel_format(
return "zip"


@set_module("pandas")
@doc(storage_options=_shared_docs["storage_options"])
class ExcelFile:
"""
Expand Down
6 changes: 5 additions & 1 deletion pandas/io/feather_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
from pandas._libs import lib
from pandas.compat._optional import import_optional_dependency
from pandas.errors import Pandas4Warning
from pandas.util._decorators import doc
from pandas.util._decorators import (
doc,
set_module,
)
from pandas.util._validators import check_dtype_backend

from pandas.core.api import DataFrame
Expand Down Expand Up @@ -68,6 +71,7 @@ def to_feather(
feather.write_feather(df, handles.handle, **kwargs)


@set_module("pandas")
@doc(storage_options=_shared_docs["storage_options"])
def read_feather(
path: FilePath | ReadBuffer[bytes],
Expand Down
2 changes: 2 additions & 0 deletions pandas/io/formats/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
Timestamp,
)
from pandas._libs.tslibs.nattype import NaTType
from pandas.util._decorators import set_module

from pandas.core.dtypes.common import (
is_complex_dtype,
Expand Down Expand Up @@ -1955,6 +1956,7 @@ def __call__(self, num: float) -> str:
return formatted


@set_module("pandas")
def set_eng_float_format(accuracy: int = 3, use_eng_prefix: bool = False) -> None:
"""
Format float representation in DataFrame with SI notation.
Expand Down
6 changes: 5 additions & 1 deletion pandas/io/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
AbstractMethodError,
EmptyDataError,
)
from pandas.util._decorators import doc
from pandas.util._decorators import (
doc,
set_module,
)
from pandas.util._validators import check_dtype_backend

from pandas.core.dtypes.common import is_list_like
Expand Down Expand Up @@ -1024,6 +1027,7 @@ def _parse(
return ret


@set_module("pandas")
@doc(storage_options=_shared_docs["storage_options"])
def read_html(
io: FilePath | ReadBuffer[str],
Expand Down
2 changes: 2 additions & 0 deletions pandas/io/iceberg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
)

from pandas.compat._optional import import_optional_dependency
from pandas.util._decorators import set_module

from pandas import DataFrame


@set_module("pandas")
def read_iceberg(
table_identifier: str,
catalog_name: str | None = None,
Expand Down
6 changes: 5 additions & 1 deletion pandas/io/json/_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
from pandas._libs.tslibs import iNaT
from pandas.compat._optional import import_optional_dependency
from pandas.errors import AbstractMethodError
from pandas.util._decorators import doc
from pandas.util._decorators import (
doc,
set_module,
)
from pandas.util._validators import check_dtype_backend

from pandas.core.dtypes.common import (
Expand Down Expand Up @@ -496,6 +499,7 @@ def read_json(
) -> DataFrame: ...


@set_module("pandas")
@doc(
storage_options=_shared_docs["storage_options"],
decompression_options=_shared_docs["decompression_options"] % "path_or_buf",
Expand Down
2 changes: 2 additions & 0 deletions pandas/io/json/_normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import numpy as np

from pandas._libs.writers import convert_json_to_lines
from pandas.util._decorators import set_module

import pandas as pd
from pandas import (
Expand Down Expand Up @@ -266,6 +267,7 @@ def _simple_json_normalize(
return normalized_json_object


@set_module("pandas")
def json_normalize(
data: dict | list[dict] | Series,
record_path: str | list | None = None,
Expand Down
2 changes: 2 additions & 0 deletions pandas/io/orc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from pandas._libs import lib
from pandas.compat._optional import import_optional_dependency
from pandas.util._decorators import set_module
from pandas.util._validators import check_dtype_backend

from pandas.core.indexes.api import default_index
Expand All @@ -35,6 +36,7 @@
from pandas.core.frame import DataFrame


@set_module("pandas")
def read_orc(
path: FilePath | ReadBuffer[bytes],
columns: list[str] | None = None,
Expand Down
6 changes: 5 additions & 1 deletion pandas/io/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
AbstractMethodError,
Pandas4Warning,
)
from pandas.util._decorators import doc
from pandas.util._decorators import (
doc,
set_module,
)
from pandas.util._validators import check_dtype_backend

from pandas import (
Expand Down Expand Up @@ -500,6 +503,7 @@ def to_parquet(
return None


@set_module("pandas")
@doc(storage_options=_shared_docs["storage_options"])
def read_parquet(
path: FilePath | ReadBuffer[bytes],
Expand Down
7 changes: 6 additions & 1 deletion pandas/io/pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
import warnings

from pandas.compat import pickle_compat
from pandas.util._decorators import doc
from pandas.util._decorators import (
doc,
set_module,
)

from pandas.core.shared_docs import _shared_docs

Expand All @@ -31,6 +34,7 @@
)


@set_module("pandas")
@doc(
storage_options=_shared_docs["storage_options"],
compression_options=_shared_docs["compression_options"] % "filepath_or_buffer",
Expand Down Expand Up @@ -114,6 +118,7 @@ def to_pickle(
pickle.dump(obj, handles.handle, protocol=protocol)


@set_module("pandas")
@doc(
storage_options=_shared_docs["storage_options"],
decompression_options=_shared_docs["decompression_options"] % "filepath_or_buffer",
Expand Down
7 changes: 6 additions & 1 deletion pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@
PerformanceWarning,
PossibleDataLossError,
)
from pandas.util._decorators import cache_readonly
from pandas.util._decorators import (
cache_readonly,
set_module,
)
from pandas.util._exceptions import find_stack_level

from pandas.core.dtypes.common import (
Expand Down Expand Up @@ -312,6 +315,7 @@ def to_hdf(
f(store)


@set_module("pandas")
def read_hdf(
path_or_buf: FilePath | HDFStore,
key=None,
Expand Down Expand Up @@ -488,6 +492,7 @@ def _is_metadata_of(group: Node, parent_group: Node) -> bool:
return False


@set_module("pandas")
class HDFStore:
"""
Dict-like IO interface for storing pandas objects in PyTables.
Expand Down
6 changes: 5 additions & 1 deletion pandas/io/sas/sasreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
overload,
)

from pandas.util._decorators import doc
from pandas.util._decorators import (
doc,
set_module,
)

from pandas.core.shared_docs import _shared_docs

Expand Down Expand Up @@ -83,6 +86,7 @@ def read_sas(
) -> DataFrame | SASReader: ...


@set_module("pandas")
@doc(decompression_options=_shared_docs["decompression_options"] % "filepath_or_buffer")
def read_sas(
filepath_or_buffer: FilePath | ReadBuffer[bytes],
Expand Down
2 changes: 2 additions & 0 deletions pandas/io/spss.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from pandas._libs import lib
from pandas.compat._optional import import_optional_dependency
from pandas.util._decorators import set_module
from pandas.util._validators import check_dtype_backend

from pandas.core.dtypes.inference import is_list_like
Expand All @@ -22,6 +23,7 @@
from pandas import DataFrame


@set_module("pandas")
def read_spss(
path: str | Path,
usecols: Sequence[str] | None = None,
Expand Down
4 changes: 4 additions & 0 deletions pandas/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
AbstractMethodError,
DatabaseError,
)
from pandas.util._decorators import set_module
from pandas.util._exceptions import find_stack_level
from pandas.util._validators import check_dtype_backend

Expand Down Expand Up @@ -263,6 +264,7 @@ def read_sql_table(
) -> Iterator[DataFrame]: ...


@set_module("pandas")
def read_sql_table(
table_name: str,
con,
Expand Down Expand Up @@ -394,6 +396,7 @@ def read_sql_query(
) -> Iterator[DataFrame]: ...


@set_module("pandas")
def read_sql_query(
sql,
con,
Expand Down Expand Up @@ -532,6 +535,7 @@ def read_sql(
) -> Iterator[DataFrame]: ...


@set_module("pandas")
def read_sql(
sql,
con,
Expand Down
2 changes: 2 additions & 0 deletions pandas/io/stata.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from pandas.util._decorators import (
Appender,
doc,
set_module,
)
from pandas.util._exceptions import find_stack_level

Expand Down Expand Up @@ -2133,6 +2134,7 @@ def value_labels(self) -> dict[str, dict[int, str]]:
return self._value_label_dict


@set_module("pandas")
@Appender(_read_stata_doc)
def read_stata(
filepath_or_buffer: FilePath | ReadBuffer[bytes],
Expand Down
6 changes: 5 additions & 1 deletion pandas/io/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
AbstractMethodError,
ParserError,
)
from pandas.util._decorators import doc
from pandas.util._decorators import (
doc,
set_module,
)
from pandas.util._validators import check_dtype_backend

from pandas.core.dtypes.common import is_list_like
Expand Down Expand Up @@ -829,6 +832,7 @@ def _parse(
)


@set_module("pandas")
@doc(
storage_options=_shared_docs["storage_options"],
decompression_options=_shared_docs["decompression_options"] % "path_or_buffer",
Expand Down
23 changes: 23 additions & 0 deletions pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,5 +538,28 @@ def test_set_module():
assert pd.pivot.__module__ == "pandas"
assert pd.cut.__module__ == "pandas"
assert pd.qcut.__module__ == "pandas"
assert pd.read_clipboard.__module__ == "pandas"
assert pd.ExcelFile.__module__ == "pandas"
assert pd.ExcelWriter.__module__ == "pandas"
assert pd.read_excel.__module__ == "pandas"
assert pd.read_feather.__module__ == "pandas"
assert pd.set_eng_float_format.__module__ == "pandas"
assert pd.read_html.__module__ == "pandas"
assert pd.read_iceberg.__module__ == "pandas"
assert pd.read_json.__module__ == "pandas"
assert pd.json_normalize.__module__ == "pandas"
assert pd.read_orc.__module__ == "pandas"
assert pd.read_parquet.__module__ == "pandas"
assert pd.read_pickle.__module__ == "pandas"
assert pd.to_pickle.__module__ == "pandas"
assert pd.HDFStore.__module__ == "pandas"
assert pd.read_hdf.__module__ == "pandas"
assert pd.read_sas.__module__ == "pandas"
assert pd.read_spss.__module__ == "pandas"
assert pd.read_sql.__module__ == "pandas"
assert pd.read_sql_query.__module__ == "pandas"
assert pd.read_sql_table.__module__ == "pandas"
assert pd.read_stata.__module__ == "pandas"
assert pd.read_xml.__module__ == "pandas"
assert api.typing.SeriesGroupBy.__module__ == "pandas.api.typing"
assert api.typing.DataFrameGroupBy.__module__ == "pandas.api.typing"
Loading