forked from jcchouinard/GoogleSearchConsole-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
19 lines (17 loc) · 614 Bytes
/
Copy pathplot.py
File metadata and controls
19 lines (17 loc) · 614 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import matplotlib.pyplot as plt
import pandas as pd
from file_manip import date_to_index
def plot_data(df,grouping,data,figsize=(6,6)):
df = df.groupby(['date',grouping])[data].nunique().reset_index()
df = df.set_index(['date',grouping])[data].unstack()
df = df.reset_index().rename_axis(None, axis=1)
df = date_to_index(df,'date')
print(f'Ploting {data} by {grouping}')
df.plot(subplots=True,
sharex=True,
figsize=figsize,
sharey=False)
plt.title(f'Number of unique {data} by {grouping}')
plt.xlabel('Date')
plt.ylabel(data)
plt.show()