Skip to content
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

ewm_mean default value does not match docstring and pandas API #13017

Closed
2 tasks done
PrettyMeng opened this issue Dec 12, 2023 · 3 comments · Fixed by #14663
Closed
2 tasks done

ewm_mean default value does not match docstring and pandas API #13017

PrettyMeng opened this issue Dec 12, 2023 · 3 comments · Fixed by #14663
Assignees
Labels
accepted Ready for implementation bug Something isn't working deprecation Add a deprecation warning to outdated functionality P-low Priority: low python Related to Python Polars

Comments

@PrettyMeng
Copy link

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

import polars as pl
df = pl.DataFrame({
    "values": [1, 2, 3, None, 5]
})
alpha = 0.5
df = df.with_columns([
    df["values"].ewm_mean(alpha=alpha).alias("ewm_mean")
])

Log output

No response

Issue description

The default value of ignore_nulls does not match docstring: "When ignore_nulls=False (default), weights are based on absolute positions." . But it actually defaults to True. Also this is inconsistent with pandas API.

Two solutions I came up with:

I prefer the second one to keep the same interface as in pandas, which could make code migration from pandas to polars easier.

Expected behavior

ignore_nulls should default to False, or at least be consistent with doc string

Installed versions

--------Version info---------
Polars:      0.18.4
Index type:  UInt32
Platform:    macOS-10.16-x86_64-arm64-64bit
Python:      3.8.0 (default, Nov  6 2019, 15:49:01)
[Clang 4.0.1 (tags/RELEASE_401/final)]

----Optional dependencies----
numpy:       1.24.4
pandas:      2.0.3
pyarrow:     14.0.1
connectorx:  0.3.2
deltalake:   0.14.0
fsspec:      2023.12.2
matplotlib:  3.7.4
xlsx2csv:    0.8.1
xlsxwriter:  3.1.9
@PrettyMeng PrettyMeng added bug Something isn't working python Related to Python Polars labels Dec 12, 2023
@ritchie46
Copy link
Member

@MarcoGorelli any opinion here?

@MarcoGorelli
Copy link
Collaborator

I'm no ewm expert, I just think I'd find ignore_nulls=False a more intuitive default

@alexander-beedie @matteosantama do you have an opinion on this one?

@stinodego stinodego added the needs triage Awaiting prioritization by a maintainer label Jan 13, 2024
@stinodego stinodego removed the needs triage Awaiting prioritization by a maintainer label Feb 23, 2024
@stinodego stinodego self-assigned this Feb 23, 2024
@stinodego stinodego added deprecation Add a deprecation warning to outdated functionality P-low Priority: low labels Feb 23, 2024
@MarcoGorelli
Copy link
Collaborator

as per discussion today - behaviour will be brought in-line with the current docstring via deprecation which will be enforced in 1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation bug Something isn't working deprecation Add a deprecation warning to outdated functionality P-low Priority: low python Related to Python Polars
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants