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
5 changes: 5 additions & 0 deletions pandas/core/reshape/melt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import numpy as np

from pandas.util._decorators import set_module

from pandas.core.dtypes.common import (
is_iterator,
is_list_like,
Expand Down Expand Up @@ -39,6 +41,7 @@ def ensure_list_vars(arg_vars, variable: str, columns) -> list:
return []


@set_module("pandas")
def melt(
frame: DataFrame,
id_vars=None,
Expand Down Expand Up @@ -275,6 +278,7 @@ def melt(
return result


@set_module("pandas")
def lreshape(data: DataFrame, groups: dict, dropna: bool = True) -> DataFrame:
"""
Reshape wide-format data to long. Generalized inverse of DataFrame.pivot.
Expand Down Expand Up @@ -361,6 +365,7 @@ def lreshape(data: DataFrame, groups: dict, dropna: bool = True) -> DataFrame:
return data._constructor(mdata, columns=id_cols + pivot_cols)


@set_module("pandas")
def wide_to_long(
df: DataFrame, stubnames, i, j, sep: str = "", suffix: str = r"\d+"
) -> DataFrame:
Expand Down
4 changes: 4 additions & 0 deletions pandas/core/reshape/pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import numpy as np

from pandas._libs import lib
from pandas.util._decorators import set_module

from pandas.core.dtypes.cast import maybe_downcast_to_dtype
from pandas.core.dtypes.common import (
Expand Down Expand Up @@ -50,6 +51,7 @@
from pandas import DataFrame


@set_module("pandas")
def pivot_table(
data: DataFrame,
values=None,
Expand Down Expand Up @@ -699,6 +701,7 @@ def _convert_by(by):
return by


@set_module("pandas")
def pivot(
data: DataFrame,
*,
Expand Down Expand Up @@ -917,6 +920,7 @@ def pivot(
return result


@set_module("pandas")
def crosstab(
index,
columns,
Expand Down
3 changes: 3 additions & 0 deletions pandas/core/reshape/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
Timestamp,
lib,
)
from pandas.util._decorators import set_module

from pandas.core.dtypes.common import (
ensure_platform_int,
Expand Down Expand Up @@ -51,6 +52,7 @@
)


@set_module("pandas")
def cut(
x,
bins,
Expand Down Expand Up @@ -287,6 +289,7 @@ def cut(
return _postprocess_for_cut(fac, bins, retbins, original)


@set_module("pandas")
def qcut(
x,
q,
Expand Down
8 changes: 8 additions & 0 deletions pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,5 +530,13 @@ def test_set_module():
assert pd.to_numeric.__module__ == "pandas"
assert pd.NamedAgg.__module__ == "pandas"
assert pd.IndexSlice.__module__ == "pandas"
assert pd.lreshape.__module__ == "pandas"
assert pd.melt.__module__ == "pandas"
assert pd.wide_to_long.__module__ == "pandas"
assert pd.crosstab.__module__ == "pandas"
assert pd.pivot_table.__module__ == "pandas"
assert pd.pivot.__module__ == "pandas"
assert pd.cut.__module__ == "pandas"
assert pd.qcut.__module__ == "pandas"
assert api.typing.SeriesGroupBy.__module__ == "pandas.api.typing"
assert api.typing.DataFrameGroupBy.__module__ == "pandas.api.typing"
Loading