utilsforecast
utilsforecast copied to clipboard
Give plot_series the option of not showing zeros
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.
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)
Closing due to lack of response.