<jupyter_start><jupyter_text>brazil_monthly_deaths - Jupyter Example  See the data First have a look on the data. The `data` variable is a pandas dataframe with data from 2015 to 2020.<jupyter_code>from brazil_monthly_deaths import data

df = data
display(df) # from 2015 to 2020<jupyter_output><empty_output><jupyter_text>Get new data and update the old data Every day there are new records, so you should get the most recent data. Keep in mind that the official data have a **legal deadline of 13 days to go from one's death to the official records**.>Depending on your internet connection it may take up to 6 minutes for each month. Consider selecting only the states you want to work on.> The following code will work only if you have installed the chrome driver, see the installation guide for more details.<jupyter_code>from brazil_monthly_deaths import brazil_deaths, update_df

# If you want to work get all data for the May 2020:
# new_data = brazil_deaths(years=[2020], months=[5])

# Select a single state for our example, running on 05/21/2020
new_data = brazil_deaths(
                years=[2020],
                months=[5],
                states=["Amazonas"],
                verbose=False,
                save_csv=False)

# update the lagging data provided by this package
df = update_df(data, new_data)
display(df)<jupyter_output><empty_output><jupyter_text>Data exploration  Selecting the data<jupyter_code>manaus_data = df.loc[
    (df['state'] == "Amazonas") &
    (df['city'] == "Manaus") &
    (df['month'] >= 2) &
    (df['month'] <= 4)
]<jupyter_output><empty_output><jupyter_text>Plotting the data<jupyter_code>import pandas as pd
from plotnine import *

# select only the variables used in the plot
manaus_data = manaus_data[['year', 'month', 'deaths']]

# transform month to category
manaus_data['month'] = pd.Categorical(manaus_data['month'])

# plot the data
dodge_text = position_dodge(width=0.9)
(
    ggplot(manaus_data, aes(x='year', y='deaths', fill='month'))
        + geom_col(stat='identity', position='dodge')
        + ggtitle("Manaus deaths Feb-Apr, 2015-2020")
        + geom_text(aes(label='deaths'), position=dodge_text, size=8, va='bottom')
        + theme_classic()
)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10423162583518931, 'fraction_numerical': 0.024053452115812918, 'mean_word_length': 4.360381861575179, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 20, 'https://': 0, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '303673', 'license': 'MIT', 'n_tokens_mistral': 776, 'n_tokens_neox': 696, 'n_words': 233, 'path': 'jupyter_example/jupyter_example.ipynb', 'repo_name': 'PedroBern/brazil-monthly-deaths-by-city', 'size': '2245'}