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

Give plot_series the option of not showing zeros #118

Closed
MMenchero opened this issue Aug 6, 2024 · 2 comments
Closed

Give plot_series the option of not showing zeros #118

MMenchero opened this issue Aug 6, 2024 · 2 comments
Labels
enhancement New feature or request feature

Comments

@MMenchero
Copy link

Description

It would be nice to have the option of not plotting zero values when using the plot_series function when they're not relevant to the analysis.

from utilsforecast.data import generate_series
from utilsforecast.plotting import plot_series
ts = generate_series(n_series=1)
ts.loc[30:50, 'y'] = 0
plot_series(ts)

We could have an optional parameter, for example exclude_zeros=True, that allows users to choose whether to plot zero values.

Use case

I'm currently working on the Python version of fpp4, specifically chapter 12.5, which involves plotting the number of calls to a bank, with no calls outside of operational hours.

@MMenchero MMenchero added enhancement New feature or request feature labels Aug 6, 2024
@MMenchero MMenchero changed the title Give plots the option of not showing missing values Give plot_series the option of not showing zeros or missing values Aug 6, 2024
@MMenchero MMenchero changed the title Give plot_series the option of not showing zeros or missing values Give plot_series the option of not showing zeros Aug 6, 2024
@jmoralez
Copy link
Member

jmoralez commented Aug 6, 2024

The book uses fill_gaps which creates NaNs for times that were missing. plot_series behaves the same way, i.e.

import pandas as pd
from utilsforecast.plotting import plot_series
from utilsforecast.preprocessing import fill_gaps

bank_calls = pd.read_csv(
    'https://nixtla-public.s3.amazonaws.com/fpp4-datasets/bank_calls.csv',
    parse_dates=['ds']
)
filled = fill_gaps(bank_calls, freq='5min', start='per_serie', end='per_serie')
plot_series(filled)

image

@jmoralez
Copy link
Member

Closing due to lack of response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature
Projects
None yet
Development

No branches or pull requests

2 participants