<jupyter_start><jupyter_text>07 - Data Visualization  Import Package<jupyter_code># Import package as pandas does not ship along as native package
# use pip install pandas if not installed yet, or follow setup guide

import pandas as pd
import matplotlib.pyplot as plt
# Use Pokemon dataset
dataframe = pd.read_csv("https://raw.githubusercontent.com/KianYang-Lee/pandas-tutorial/main/datasets/Pokemon.csv")<jupyter_output><empty_output><jupyter_text>Practice Section Create the following visualizations, complete with styling that provides context to readers:
- Bar chart of Type 2 Pokemon count
- Line chart of Pokemon count for each generation
- Boxplot for Pokemon Speed distribution<jupyter_code># - Bar chart of Type 2 Pokemon count
dataframe["Type 2"].value_counts().plot(
    kind="bar",
    title="Type 2 Pokemon Count",
    xlabel="Secondary type (Type 2) for Pokemon",
    ylabel="Count",
)
plt.show()
# - Line chart of Pokemon count for each generation
pokemon_count_by_gen = dataframe["Generation"].value_counts()
pokemon_count_by_gen.index = dataframe["Generation"].value_counts().index.map(lambda x: str(x)+'_Gen')
pokemon_count_by_gen.sort_values(ascending=False).plot(
    kind="line",
    title="Number of Pokemon by Generation",
    xlabel="Pokemon Generation",
    ylabel="Number of Pokemon",
)
plt.show()
# - Boxplot for Pokemon Speed distribution
dataframe.Speed.plot(
    kind="box",
    title="Pokemon Speed Distribution",
    xlabel="Speed",
    ylabel="Value",
)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10347043701799485, 'fraction_numerical': 0.004498714652956298, 'mean_word_length': 4.853383458646617, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '497846', 'license': 'MIT', 'n_tokens_mistral': 497, 'n_tokens_neox': 475, 'n_words': 136, 'path': 'solutions/07_data_visualization.ipynb', 'repo_name': 'KianYang-Lee/pandas-tutorial', 'size': '1556'}