Exploratory Analysis on Genshin Impact Characters with Pandas & Seaborn: Liyue team stronger than Mondstadt?
By: Taufiq Bashori
Tags: Seaborn, Python, Data Science, Genshinimpact, Pandas

The windblume festival is coming to an end. It’s been a while since our Traveler first came to Teyvat. With Genshin Impact revenue just exceeded $1 billion this march, so much also had happened during our time exploring Mondstadt and journeying to Liyue. From rescuing Dvalin, protecting the Jade Chamber, helping Ella Musk practice Hilicurlian, paying tribute to the Adeptus, to ‘taking care’ of Timmie’s birds... you name it.

With as many as 30 playable (uhm, gacha-able) characters and its ever expanding world, we sure have a lot to cover. The depth of combat system and the numerous stats of the characters have also given rise to community of streamers to showcase on how to best play each character, usually followed by debates on which one(s) can give highest damage output.

This article aims to contribute to similar discourse by taking a slightly different angle, that is: are characters coming from most recent region (Liyue) likely, objectively stronger? It’s an interesting question as Mihoyo has the tendency to introduce OP’d characters (and sometimes allegedly nerfed them, but not true) and since we’re seeing multiple new characters from Liyue.

Methodology

The comparison will look at base stat of ATK & DEF of the characters at level 90, controlling for available features such as Elements, Weapon Type & Nation. This ignores other variables which can make a character ridiculously strong, such as; Artefacts, Equipment, Ascension Stats, Constellations, Elemental Reactions, Resonance, Passives/Talents, Playstyle and of course — Skill of the character & player.

The approach makes use of Pandas for reading html source table and creating dataframe, and followed by Seaborn for simple data visualization.

Data Source

We’ll be importing the data from Genshin-Impact Fandom wiki website using Pandas. The screenshots of the tables that we want to retrieve are as follows;

Image 1: Base Stats of 30 Characters at Level 90 (from genshin-impact.fandom.com)

Image 2: Playable Characters Information (from genshin-impact.fandom.com)

Data Preparation & Analysis

a. Importing the Dataset

Using Pandas read_html, we fetch the table we want through url1 & url2 and name it df1 & df2. The index[0] and [1] is the location of the table that we want. Python start the indexing at 0, so having [0] and [1] means the correct table is table 1 for url1, and table 2 for url2. Some NaN column are removed by .drop method, and the resulting tables are merged into df3.

Using df3.head(5) to check the first 5 rows of data generates this result;

Merged df3 table shows all information we need

Now a good practice is to make sure that there really aren’t NaN values for the columns that we want. We can use following syntax to check;

df3.info()

df3.info() shows Non Null Count & Data Type

Perfect! Now that we have all the data we need with no null values and correct data type, we’re ready to move to the 2nd part of the problem, Exploratory Data Analysis (EDA) using Seaborn!

b. Seaborn for EDA

First, we’ll be importing the library seaborn & pyplot. Then we define color palette dictionary to make each category more visually distinct. For our first exploration, we’ll be using countplot to explore our data. The code can be seen below;

The result is as follows:

Data Exploration with countplot, result for df3 dataset

Interesting! From 30 character, >50% are from Mondstadt. Maybe that’s why characters from Liyue keep coming? Most of the characters are sword users and Female, unsurprising. Pyro, the so called strongest element is the highest! We’re ready to move to compare Liyue & Mondstadt. Before we move on though, Snezhnaya Region (Childe) and Adaptive Element (Traveler) might need to be omitted.

c. Comparing Visions (Element): Mondstadt vs Liyue

We’ll be using relplot to visualize visions (element) comparison, Mondstadt vs Liyue. The code can be seen as below.

The result is as follows:

Comparing Visions (Element) Users, Mondstadt vs Liyue

Do you notice the pattern? Mondstadt has only 2 character with >300 base ATK at level 90, compared to 3 for Liyue. Mondstadt only have 1 character with > 850 base DEF, compared to 2 for Liyue. Not only that, the only Vision (Element) which stand out in both ATK & DEF from Mondstadt is Pyro (can you guess who?), while from Liyue we’re seeing Anemo, Electro & Cryo. Isn’t it interesting to realize the highest Anemo character is coming from Liyue?

Note: on larger datasets, it’d be best to user percentiles to determine the upper threshold value. But given the small samples, the ATK (>300) & DEF (>850) threshold should be ‘ok’ to be arbitrarily defined by looking at the visuals.

d. Comparing Weapon Type: Mondstadt vs Liyue

Okay, so maybe it’s not enough to look only at elements. After all, weapon type can affect playstyle/ how a character contributes to the team. So next we’ll be using relplot to visualize weapon type comparison, Mondstadt vs Liyue. The code can be seen as below.

The result is as follows;

Comparing Weapon Type, Mondstadt vs Liyue

Hmm it seems that for Claymore, Mondstadt offers the best character to use. To lesser extend also, Catalyst. Mondstadt not having any polearm character is probably worth to notice (*cough* Rosaria *cough*). Looking at Liyue, it hands down offers more versatility. Not only the characters with the highest ATK come from different element, they’re also of different weapon type; Polearm, Bow & Sword. Great!

e. Wrap Up: Plotting All Character ATK & DEF

Okay now that we know how to compare Mondstadt & Liyue, let’s compare all characters and see which one is located in relative with others when it comes to base ATK & DEF. The code used is as follows:

The result is as follows:

Plotting All Characters based on ATK & DEF

The result seems to suggest that the top 5 highest base ATK characters are Xiao, Ganyu, Diluc, Keqing & Klee. Unsurprisingly, all of them are 5 stars characters (lowest pull rate from gacha) and 3 of them (Xiao, Ganyu & Keqing) are from Liyue. All else equals, those 5 will give the highest ATK when you maxed them to level 90 hence potentially give higher damage output. While having highest ATK does not necessarily create highest value to your team, most players would agree that these 5 sure worth taking a look (& perhaps wishing for?).

Conclusion

From both visions (element) and weapon type perspective, Liyue has more characters with higher ATK & overall DEF than Mondstadt. So does from weapon type perspective.

Liyue is harsh, its characters are strong. Mondstadt has had festivals, Liyue has had some death parting rituals. While NPC in Mondstadt often offers quest like picking up flowers or retrieving goods, NPCs in Liyue share the lives similar to pre-modern era where there have been many tragic accidents, resource exploitations and land full of treasure hoarders, leading to one of the most heart-breaking quests in the GI universe — like this one.

Maybe that’s why it makes sense to have stronger character so that they can survive Liyue. Or maybe it’s just a coincidence because some of them are Adepti? Or could it be that it’s just Mihoyo trying to level up their gacha game? Tell me what you think.

Note: Full version of the code is available in this notebook.