<jupyter_start><jupyter_text>1.2. Getting started with exploratory data analysis in the Jupyter Notebook<jupyter_code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('retina')
url = ("https://raw.githubusercontent.com/"
       "ipython-books/cookbook-2nd-data/"
       "master/bikes.csv")
df = pd.read_csv(url, index_col='Date',
                 parse_dates=True, dayfirst=True)
df.head(2)
df.describe()
df[['Berri1', 'PierDup']].plot(figsize=(16, 10),
                               style=['-', '--'],
                               lw=2)
df.index.weekday_name
df_week = df.groupby(df.index.weekday).sum()
df_week
fig, ax = plt.subplots(1, 1, figsize=(16, 10))
df_week.plot(style='-o', lw=3, ax=ax)
ax.set_xlabel('Weekday')
# We replace the labels 0, 1, 2... by the weekday
# names.
ax.set_xticklabels(
    ('Monday,Tuesday,Wednesday,Thursday,'
     'Friday,Saturday,Sunday').split(','))
ax.set_ylim(0)  # Set the bottom axis to 0.
from ipywidgets import interact

@interact
def plot(n=(1, 30)):
    fig, ax = plt.subplots(1, 1, figsize=(16, 10))
    df['Berri1'].rolling(window=n).mean().plot(ax=ax)
    ax.set_ylim(0, 7000)
    plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15695415695415696, 'fraction_numerical': 0.028749028749028748, 'mean_word_length': 3.7007299270072993, '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': '189544', 'license': 'MIT', 'n_tokens_mistral': 514, 'n_tokens_neox': 478, 'n_words': 98, 'path': 'chapter01_basic/02_pandas.ipynb', 'repo_name': 'deepkick/cookbook-2nd-code', 'size': '1287'}