<jupyter_start><jupyter_text><jupyter_code>import pandas as pd
url = 'https://raw.githubusercontent.com/tokyo-metropolitan-gov/covid19/development/data/data.json'
df = pd.read_json(url)

df.get('patients_summary').get('data')
df = pd.DataFrame(df['patients_summary']['data'])
df
df.index = pd.to_datetime(df['日付'])
_df = pd.DataFrame(df['小計'], index=df.index)
_df
df.index
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib import ticker
from tqdm.notebook import tqdm

%matplotlib inline
sns.set()
w_mean = df.groupby(pd.Grouper(freq='W')).mean()
smonth_mean = df.groupby(pd.Grouper(freq='SM')).mean()
month_mean = df.groupby(pd.Grouper(freq='M')).mean()
q_mean = df.groupby(pd.Grouper(freq='Q')).mean()
fig, ax = plt.subplots(figsize = (18,10)) 

x = df['日付']

ax.plot(_df, label='src')
ax.plot(w_mean, label='w')
ax.plot(smonth_mean, label='sm')
ax.plot(month_mean, label='m')
ax.plot(q_mean, label='q')
ax.set(xlabel='date',ylabel='cnt' )
ax.legend()

ax.set_xticklabels(labels=df.index, rotation=90, ha='center')
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d'))
ax.xaxis.set_major_locator(ticker.MultipleLocator(20))

w_mean_2 = df.resample('W').mean()
smonth_mean_2 = df.resample('SM').mean()
month_mean_2 = df.resample('M').mean()
q_mean_2 = df.resample('Q').mean()
fig, ax = plt.subplots(figsize = (18,10)) 

x = df['日付']

ax.plot(w_mean_2, label='w')
ax.plot(smonth_mean_2, label='sm')
ax.plot(month_mean_2, label='m')
ax.plot(q_mean_2, label='q')
ax.set(xlabel='date',ylabel='cnt' )
ax.legend()

ax.set_xticklabels(labels=df.index, rotation=90, ha='center')
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d'))
ax.xaxis.set_major_locator(ticker.MultipleLocator(20))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19584736251402918, 'fraction_numerical': 0.014590347923681257, 'mean_word_length': 7.331775700934579, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '507056', 'license': 'MIT', 'n_tokens_mistral': 761, 'n_tokens_neox': 750, 'n_words': 102, 'path': 'pandas_test.ipynb', 'repo_name': 'sakasa/notebooks', 'size': '1782'}