Pair Plot Analysis of Pokemon Stats

Assuming you’ve loaded a Pokemon dataset from an external URL, create a pair plot for the first four stats: HP, Attack, Defense, and Speed. Use the ‘Type 1’ column to color the data.

Example Output:

Utilize the sns.pairplot function, and the dataset can be fetched using pd.read_csv(URL).

import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt

def plot_pokemon_pairplot():
    URL = "https://raw.githubusercontent.com/KeithGalli/pandas/master/pokemon_data.csv"
    pokemon_data = pd.read_csv(URL)
    sns.pairplot(pokemon_data, hue='Type 1', vars=['HP', 'Attack', 'Defense', 'Speed'])
    plt.suptitle('Pair Plot Analysis of Pokemon Stats', y=1.02)
    plt.show()

plot_pokemon_pairplot()

 

© Let’s Data Science

LOGIN

Unlock AI & Data Science treasures. Log in!