image_output_1.png
import matplotlib.pyplot as plt

import os

import pandas as pd

import seaborn as sns

import warnings

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import os
import warnings
sns.set_style('darkgrid')
warnings.filterwarnings('ignore')

df = pd.read_csv('/kaggle/input/destiny-2-guns/guns.csv')

# count of weapons, breakdown by Element and Rarity
features = ['Element ','Rarity']
fig, ax = plt.subplots(1,len(features),figsize=(16,5), sharex=False)

for cnt, feature in enumerate(['Element ','Rarity']):
    df.groupby(['weapon_type',feature]).size().unstack().plot(kind='barh', stacked=True, ax=ax[cnt])
plt.tight_layout()
plt.show()

features = ['Element ', 'Rarity', 'weapon_type']
fig, ax = plt.subplots(2, 3, figsize=(18, 8))
for cnt, f in enumerate(features):
    current_col = int(cnt % 3)
    tmp = df[[f, 'gun_RoF']].sort_values(by=['gun_RoF'], ascending=True)
    sns.boxplot(ax=ax[0, current_col], data=tmp, x='gun_RoF', y=f, linewidth=2, showfliers=False)
    sns.histplot(ax=ax[1, current_col], data=tmp, x='gun_RoF', hue=f, kde=True, bins=20, legend=False, line_kws={'lw': 2}, alpha=0.5)
plt.tight_layout()
plt.show()