kopia lustrzana https://github.com/mkdryden/telegram-stats-bot
stats: zero-fill days without data for history
rodzic
12eb2d7fec
commit
c722d2c750
|
@ -12,6 +12,7 @@ Unreleased
|
||||||
Fixed
|
Fixed
|
||||||
-----
|
-----
|
||||||
- Allow quotes in lquery parameters
|
- Allow quotes in lquery parameters
|
||||||
|
- Zero-fill days without data for history
|
||||||
|
|
||||||
---------------------
|
---------------------
|
||||||
`0.4.0`_ - 2021-06-06
|
`0.4.0`_ - 2021-06-06
|
||||||
|
|
|
@ -494,6 +494,8 @@ class StatsRunner(object):
|
||||||
|
|
||||||
df['day'] = pd.to_datetime(df.day)
|
df['day'] = pd.to_datetime(df.day)
|
||||||
df['day'] = df.day.dt.tz_convert(self.tz)
|
df['day'] = df.day.dt.tz_convert(self.tz)
|
||||||
|
df = df.set_index('day')
|
||||||
|
df = df.resample('1D').sum()
|
||||||
|
|
||||||
if averages is None:
|
if averages is None:
|
||||||
averages = len(df) // 20
|
averages = len(df) // 20
|
||||||
|
@ -507,9 +509,9 @@ class StatsRunner(object):
|
||||||
|
|
||||||
fig = Figure(constrained_layout=True)
|
fig = Figure(constrained_layout=True)
|
||||||
subplot = fig.subplots()
|
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:
|
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_ylabel("Messages")
|
||||||
subplot.set_xlabel("Date")
|
subplot.set_xlabel("Date")
|
||||||
if lquery:
|
if lquery:
|
||||||
|
|
Ładowanie…
Reference in New Issue