text_html_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import plotly.express as px

import seaborn as sns

training_set = pd.read_parquet('/kaggle/input/unswnb15/UNSW_NB15_training-set.parquet')
testing_set = pd.read_parquet('/kaggle/input/unswnb15/UNSW_NB15_testing-set.parquet')

training_set.dtypes

training_set.attack_cat.value_counts()

training_set.dtypes

target = 'label'
features = list(training_set.columns.difference([target]).values)

training_set.drop(columns=['attack_cat'], inplace=True)
testing_set.drop(columns=['attack_cat'], inplace=True)

training_set.isna().sum()

cat_cols = [col for col in training_set.columns if training_set[col].dtype == 'category']
cat_cols

# fig, axes = plt.subplots(15,4, figsize=(25,70))
# axes=axes.flatten()
# for i, col in enumerate(df_train.columns):
#     sns.histplot(df_train,x=col, stat='percent', hue="Label", bins=100, log_scale=(False, False), ax=axes[i])
    
fig=plt.figure(figsize=(25,70))
for i, col in enumerate(training_set.columns):
    plt.subplot(15,4,i+1)
    sns.histplot(training_set,x=col, stat='percent', hue="label", bins=100, log_scale=(False, False))
fig.tight_layout()
plt.show()

metadata = ['service']

training_set.drop(columns=metadata, inplace=True)
testing_set.drop(columns=metadata, inplace=True)

import plotly.express as px

training_set.dttl = training_set.dttl.astype('uint8')
px.histogram(training_set, x='dttl', color='label', barmode='group')