Skip to content

Rework groupby and resample core modules #848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Feb 6, 2024
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
6 changes: 3 additions & 3 deletions pandas-stubs/core/groupby/generic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT]):
) -> DataFrame: ...
@overload
def boxplot(
grouped,
grouped, # pyright: ignore[reportSelfClsParameterName]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use self here (and in the other overloads)?

subplots: Literal[True] = ...,
column: IndexLabel | None = ...,
fontsize: float | str | None = ...,
Expand All @@ -268,7 +268,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT]):
) -> Series: ... # Series[PlotAxes] but this is not allowed
@overload
def boxplot(
grouped,
grouped, # pyright: ignore[reportSelfClsParameterName]
subplots: Literal[False],
column: IndexLabel | None = ...,
fontsize: float | str | None = ...,
Expand All @@ -284,7 +284,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT]):
) -> PlotAxes: ...
@overload
def boxplot(
grouped,
grouped, # pyright: ignore[reportSelfClsParameterName]
subplots: bool,
column: IndexLabel | None = ...,
fontsize: float | str | None = ...,
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ mypy = "1.8.0"
pandas = "2.1.4"
pyarrow = ">=10.0.1"
pytest = ">=7.1.2"
pyright = ">=1.1.346"
pyright = "==1.1.346"
poethepoet = ">=0.16.5"
loguru = ">=0.6.0"
typing-extensions = ">=4.4.0"
Expand Down Expand Up @@ -191,7 +191,6 @@ reportUnknownParameterType = false
reportUnknownVariableType = false
reportUnusedVariable = false
reportPrivateUsage = false
reportSelfClsParameterName = false
# enable optional checks
reportMissingModuleSource = true
useLibraryCodeForTypes = false
Expand Down
6 changes: 3 additions & 3 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ def test_types_groupby() -> None:
df6: pd.DataFrame = df.groupby(by=["col1", "col2"]).nunique()
with pytest_warns_bounded(
FutureWarning,
"The provided callable <built-in function sum> is currently using",
"(The provided callable <built-in function sum> is currently using|The behavior of DataFrame.sum with)",
lower="2.0.99",
):
df7: pd.DataFrame = df.groupby(by="col1").apply(sum)
Expand Down Expand Up @@ -1252,7 +1252,7 @@ def test_types_agg() -> None:

with pytest_warns_bounded(
FutureWarning,
r"The provided callable <built-in function (min|max)> is currently using",
r"The provided callable <(built-in function (min|max|mean)|function mean at 0x\w+)> is currently using",
lower="2.0.99",
):
check(assert_type(df.agg(min), pd.Series), pd.Series)
Expand Down Expand Up @@ -1711,7 +1711,7 @@ def test_types_regressions() -> None:
df = pd.DataFrame({"A": [1, 2, 3], "B": [5, 6, 7]})
with pytest_warns_bounded(
FutureWarning,
"The 'closed' keyword in DatetimeIndex construction is deprecated",
"The '(closed|normalize)' keyword in DatetimeIndex construction is deprecated",
lower="2.0.99",
):
pd.DatetimeIndex(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ def test_types_agg() -> None:
check(assert_type(s.agg("mean", axis=0), float), np.float64)
with pytest_warns_bounded(
FutureWarning,
r"The provided callable <built-in function (min|max|mean)> is currently using",
r"The provided callable <(built-in function (min|max|mean)|function mean at 0x\w+)> is currently using",
lower="2.0.99",
):
check(assert_type(s.agg(min), int), np.integer)
Expand Down