application_vnd.jupyter.stderr_output_1.png
from sklearn.feature_selection import SelectKBest, f_classif

import numpy as np

import pandas as pd

df = pd.read_csv('/kaggle/input/ddos-dataset/Friday-WorkingHours-Afternoon-DDos.pcap_ISCX.csv')

df.columns

columns_to_drop = ['Flow ID', ' Source IP', ' Destination IP', ' Timestamp']
df = df.drop(columns_to_drop, axis=1)

df.columns

df = df[~np.isinf(df['Flow Bytes/s'])]
df.dropna(inplace=True)

X = df.drop(' Label', axis=1)
y = df[' Label']

num_columns = X.shape[1]

k = 15
selector = SelectKBest(score_func=f_classif, k=k)
X_train_selected = selector.fit_transform(X_train, y_train)
X_test_selected = selector.transform(X_test)

selected_feature_names = X.columns[selector.get_support()]
selected_feature_names