Kill analysis of the popular game PUPG. Use seaborn-pair plot.

The world of PUPG that people all over the world are enthusiastic about. After all, I'm curious about strong weapons.

So I read the csv file and write about 30 lines of code with pairplot I tried to visualize it.

What happens

I recently touched seaborn's pair plot and found it interesting, and I thought I could try it with something other than solid data such as iris and Titanic, so I tried it. Therefore, the data and method used for plotting may be incorrect. If this is the case, I would appreciate it if you could give me some advice.

Reference of csv →

https://www.kaggle.com/skihikingkevin/pubg-match-deaths? This is kaggle.


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

df = pd.read_csv("Path to csv")
#It cannot be plotted unless it is numerical data.
show_df = df.drop(['victim_position_x','victim_position_y','victim_placement','killer_placement','killer_name'],axis=1)
#Defect value supplement
show_df['kill_position_x'] = show_df['killer_position_x'].fillna(show_df['killer_position_x'].mean())
show_df['kill_position_y'] = show_df['killer_position_y'].fillna(show_df['killer_position_y'].mean())
#Defect value removal
show_df = show_df.drop(['killer_position_x','killer_position_y'],axis=1)
print(show_df.isna().all(axis=0))
#Converted so that the gun can be identified by a number.
show_df['gan_type'] = show_df['killed_by'].replace({'Punch':0,'Deagle':1,'P1911':2,'R45':3,'R1895':4,'P18C':5,'P92':6,\
                                     'Skorpion':7,'S12K':8,'S1897':9,'S686':10,'DBS':11,'Tommy Gun':12,\
                                     'Vector':13,'Micro UZI':14,'MP5K':15,'PP-19 Bizon':16,'UMP45':17,\
                                     'AUG':18,'G36C':19,'M16A4':20,'M416':21,'M762':22,'Mk47 Mutant':23,\
                                     'QBZ':24,'SCAR-L':25,'AKM':26,'GROZA':27,'M249':28,'DP-28':29,\
                                     'AWM':30,'Win94':31,'Kar98k':32,'M24':33,'mini14':34,'QBU':35,'Mk14':36,'SKS':37,\
                                     'SLR':38,'VSS':39,'Bluezone':40,'Down and Out':41,'Falling':42,'Grenade':43,'Hit by Car':44,'death.WeapSawnoff_C':45,'Mini 14':46,\
                                     'UMP9':47,'Machete':48,'Sickle':49,'Groza':50,'Crossbow':51,'Drown':52,'Uaz':53,'Pan':54,'RedZone':55,'Motorbike':56,'Buggy':57,\
                                     'death.ProjMolotov_DamageField_C':58,'Dacia':59,'Motorbike (SideCar)':60,'death.Buff_FireDOT_C':61,'Crowbar':62,'Van':63,'Pickup Truck':64,\
                                     'Aquarail':65,'Boat':66,'death.ProjMolotov_C':67,'death.PG117_A_01_C':68,'death.RedZoneBomb_C':69,'death.PlayerMale_A_C':70}).astype(int)
two = print(show_df.head(10))
w = sns.pairplot(show_df[0:101],hue='killed_by')
w.savefig('PUPG.png')
plt.show()

PUPG.png

time → time killed? Maximum unit second killed_by → This is similar to gan_type below, but specified as an argument of hue. gan_type → It is a literal translation of the gun type, but the ones caused by the cause of death are summarized.       At first, I was thinking of scraping the information about pupg's weapon and passing it to the dictionary, but when I implemented it so that the desired information was stored in various tags (a, b, strong) and took everything, 300 lines I gave up this time and tried to do it because it became a code and scraped the items attached to other guns, but it took a long time. .. ..

Example: I was pulled by a car. I was run over by a bicycle. I was killed by a punch. Such kill_position → Killed coordinates?

Did you see the data? ?? ?? ??

  1. It was used when many guns called M416 were killed from 0 to 2000 seconds (time until the winner came out) after seeing the time.

It suffers a little from 2 and 1, but I think there are many people who use a gun called M416 to dig into the upper ranks.

  1. From the relationship between the x-coordinate and the y-coordinate, it can be seen that many people died at the x-coordinate of about 400000 to 500000 and the y-coordinate of about 300000.

Recommended Posts

Kill analysis of the popular game PUPG. Use seaborn-pair plot.
[GWAS] Plot the results of principal component analysis (PCA) by PLINK
Plot the spread of the new coronavirus