# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# import the module pandas
import pandas as pd

# +
# Set the path of the Pokemon csv file to be loaded from the Resources folder.
    # Define the path name as GSPC_path
pokemon_path = "Resources/Pokemon.csv"


# Define a variable "BAC_df" and store the BAC.csv into Pandas DataFrame using the BAC_path
pokemon_df = pd.read_csv(pokemon_path, encoding="utf-8")

# Print out the first 5 rows.
pokemon_df.head()

# -

# Use the describe function on pokemon_df to review general info on Total percentiles.
pokemon_df.describe()

# +
# Create the variable bins for data storage.
    # Bins are 0, 330, 450, 515, 600, 700, 800
bins = [0, 330, 450, 515, 600, 700, 800]

# Create names for the bins
# group_names to be "Very Weak", "Weak", "Moderate", "Strong", "Very Strong", "Over Powered"
group_names = ["Very Weak", "Weak", "Moderate", "Strong", "Very Strong", "Over Powered"]


# +
# Add a column named "Total Ranking" to pokemon_df and slice with bins
pokemon_df["Total Ranking"] = pd.cut(pokemon_df["Total"], bins, labels=group_names)

# Print out the first 10 rows of pokemon_df.
pokemon_df.head(10)

# +
# Set new index to Total Ranking
pokemon_df = pokemon_df.set_index("Total Ranking")

# Find all pokemon with a Total Ranking of "Over Powered" using Loc.
pokemon_df.loc["Over Powered"]

# +
# Set the variable overpowered_df to be the pokemon dataframe with Over Powered only.
overpowered_df = pd.DataFrame(pokemon_df.loc["Over Powered"])

# Print the overpowered_df
overpowered_df
# -

# Use the value_counts and sum functions 
    # to get the total number of Over Powered pokemon from overpowered_df.
overpowered_df["#"].value_counts().sum()

StarcoderdataJupyterScriptsDedupFiltered