Home > database >  Panda returns zero entries though the entries are available on the dataset
Panda returns zero entries though the entries are available on the dataset

Time:01-12

I have been working a dataset named InSDN, and preprocessing the dataset using panda. After loading the data I can not retrieve the DDoS entries though the records are available in the dataset and I am able to retrieve other attack entries like DoS.

#import the dataset
df = pd.read_csv('./InSDN_DatasetCSV/OVS.csv')
df['Label'].value_counts() 

#returns #returns DoS, DDoS, Probe, BFA, Web-Attack, BOTNET
df = df[df['Label'] == 'DoS']
df.shape #returs (52471, 84)

#for DDoS conditon
df = df[df['Label'] == 'DDoS']
df.shape #returs (0, 84), but as it is shown in the above code section it has 48413 entries.

CodePudding user response:

If you look at the index of the df you will find that it's 'DDoS ' with an extra space.

>>> df['Label'].value_counts().index
Index(['DoS', 'DDoS ', 'Probe', 'BFA', 'Web-Attack', 'BOTNET'], dtype='object')
  • Related