stats: zero-fill days without data for history

pull/6/head
Michael D. M. Dryden 2021-06-07 23:39:06 -04:00
rodzic 12eb2d7fec
commit c722d2c750
2 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -12,6 +12,7 @@ Unreleased
Fixed
-----
- Allow quotes in lquery parameters
- Zero-fill days without data for history
---------------------
`0.4.0`_ - 2021-06-06

Wyświetl plik

@ -494,6 +494,8 @@ class StatsRunner(object):
df['day'] = pd.to_datetime(df.day)
df['day'] = df.day.dt.tz_convert(self.tz)
df = df.set_index('day')
df = df.resample('1D').sum()
if averages is None:
averages = len(df) // 20
@ -507,9 +509,9 @@ class StatsRunner(object):
fig = Figure(constrained_layout=True)
subplot = fig.subplots()
df.plot(x='day', y='messages', alpha=alpha, legend=False, ax=subplot)
df.plot(y='messages', alpha=alpha, legend=False, ax=subplot)
if averages:
df.plot(x='day', y='msg_rolling', legend=False, ax=subplot)
df.plot(y='msg_rolling', legend=False, ax=subplot)
subplot.set_ylabel("Messages")
subplot.set_xlabel("Date")
if lquery: