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

fix: limit default lags in autocorrelation #154

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,17 @@ def plot_acf(
for col in columns:
if not is_numeric(df[col]):
raise ValueError(f"Cannot plot autocorrelation for non-numeric column `{col}`")
if lags is None:
max_lags = min(15, len(df) // 2)
lags = list(range(max_lags))
mbelak-dtml marked this conversation as resolved.
Show resolved Hide resolved
plot_func = (
functools.partial(tsaplots.plot_pacf, method="ywm") if partial else tsaplots.plot_acf
functools.partial(tsaplots.plot_pacf, method="ywm", lags=lags)
if partial
else tsaplots.plot_acf
lukany marked this conversation as resolved.
Show resolved Hide resolved
)
for col in columns:
display(Markdown(f"---\n### {col}"))
fig = plot_func(df[col].dropna(), lags=lags)
fig = plot_func(df[col].dropna())
ax = fig.axes[0]
ax.set_title("")
ax.set_xlabel("Lag")
Expand Down