Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
Remove one data column before aggregating the data
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Apr 30, 2023
1 parent a730e9b commit 1ab6b68
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/manydataapi/plotting/timeseries.py
Expand Up @@ -71,8 +71,11 @@ def plot_aggregated_ts(df, value, date=None, agg="month", ax=None,
df[col2] = df[date].dt.hour
key = [col2, col1]
vals = [_ for _ in sorted(set(df[col1])) if not numpy.isnan(_)]
drop_cols = [col1]
if date is not None:
drop_cols.append(date)
for v in vals:
gr = df[df[col1] == v].drop(col1, axis=1).groupby(col2).sum()
gr = df[df[col1] == v].drop(drop_cols, axis=1).groupby(col2).sum()
gr.columns = ['wk=%d' % v]
gr.plot(kind=kind, ax=ax, **kwargs)
else:
Expand Down

0 comments on commit 1ab6b68

Please sign in to comment.