I wanted to find a Pokemon that could use the trick room in a Pokemon match, but I was wondering which Pokemon to use. First of all, when using the trick room, I thought that a Pokemon that could withstand the attack from the opponent would be good because it would be a follower, so I wanted to find a Pokemon with a low race value and high defense and special defense. .. So I came up with the idea of narrowing down the search from csv data using the programming language Python.
-Install Excel or Numbers ・ Installation of Anaconda -Installation of Python and Pandas
① Download and create csv file You can download the csv file of the Pokemon race value from the following URL. https://www.kaggle.com/abcsds/pokemon This csv file does not contain data for 7-8 generation Pokemon. Also, since it is written in English, the name of Pokemon is also in English, so it may be a little difficult to handle.
The 8th generation Pokemon (Pokemon that appeared in the sword shield) took some time to copy the data from the URL below, but I arranged the table on Excel and made it a csv file. https://wiki.ポケモン.com/wiki/種族値一覧_(第八世代)
② Narrow down the race value with Python First, try reading the data from the csv file. Drag the icon of the installed csv file to put it in the file list on the left side of the screen. Next, enter the following code in Anacoda's Jupyter Lab.
import pandas as pd
df = pd.read_csv("Pokemon.csv")
df
Then, the list will be displayed on the screen as shown in the figure below.
Next, I would like to narrow down the Esper type Pokemon excluding the legend. Try entering the following code.
df.loc[(df.Legendary == False) & (df["Type 1"] == "Psychic")]
Then, I think that a list of non-legendary Esper type Pokemon is displayed as shown in the screen below.
Then, take over the list results narrowed down earlier and enter the following code to search for Pokemon with a defense race value of 60 or more and agility of 65 or less.
df = df.loc[(df.Legendary == False) & (df["Type 1"] == "Psychic")]
df.loc[(df.Defense >= 60) & (df.Speed <= 65)]
As a result of inputting, I think that I narrowed down considerably.
Finally, enter the following code to sort the defense race values in descending order and you're done.
df = df.loc[(df.Defense >= 60) & (df.Speed <= 65)]
df.sort_values(by = ['Defense'], ascending = False)
In summary, you can easily get the result by entering the following code.
import pandas as pd
df = pd.read_csv("Pokemon.csv")
df = df.loc[(df.Legendary == False) & (df["Type 1"] == "Psychic")]
df = df.loc[(df.Defense >= 60) & (df.Speed <= 65)]
df.sort_values(by = ['Defense'], ascending = False)
Since it was difficult to understand Pokemon with English names, I also read the csv file with Japanese names created from the list copied from the URL and narrowed it down in the same way. Name the file Pokemon_data.csv and enter the code below to get the result.
import pandas as pd
df = pd.read_csv("Pokemon_data.csv")
df = df.loc[(df.Legend== False) & (df["Type 1"] == "Esper")]
df = df.loc[(df.defense>= 60) & (df.Agility<= 65)]
df.sort_values(by = ['defense'], ascending = False)
What I found was that Brimon and Musharna were equally low in quickness and high in defense and special defense, so I interpreted them as candidates for Pokemon to use the trick room.
There are other Pokemon that are ghost type and can use trick rooms, so it may be good to enter the code and search for it as well.
You can practice code using Pandas at the URL below. I think it's a good reference for studying programming.
https://www.kaggle.com/learn/pandas
Recommended Posts