text_html_output_1.png
import pandas as pd

df = pd.read_csv('../input/pokemon-dataset/pokemon_data.csv')

df.columns
df.Name
df[['Name', 'Type 1', 'HP']]
df.iloc[0]
df.loc[df['Name'] == 'Ivysaur']
df.iloc[0, 1]

df.sort_values('HP', ascending=False)
df.sort_values(['HP', 'Attack'], ascending=[1, 0])

df['Total'] = df.iloc[:, 4:10].sum(axis=1)
df
cols = list(df.columns)
df = df[cols[:4] + [cols[-1]] + cols[4:12]]
df

df.to_csv('modified_pokemon_data.csv')

df = pd.read_csv('./modified_pokemon_data.csv')
df

df.loc[df['Type 1'] == 'Flamer', 'Legendary'] = True
df = pd.read_csv('./modified_pokemon_data.csv')
df

df.loc[df['Total'] > 500, ['Generation', 'Legendary']] = 'Highest'
df.loc[df['Total'] > 500, ['Generation', 'Legendary']] = ['Highest Gen', 'Highest Legend']

df = pd.read_csv('./modified_pokemon_data.csv')
df

df.groupby(['Type 1']).mean().sort_values('Defense', ascending=False)['Defense']
df.groupby(['Type 1']).mean().sort_values('Attack', ascending=False)['Attack']
df.groupby(['Type 1']).mean().sort_values('HP', ascending=False)['HP']

df.groupby(['Type 1']).count()['Name']