rdpahalavan commited on
Commit
3115a3e
1 Parent(s): f10c759

Update CIC-IDS2017.py

Browse files
Files changed (1) hide show
  1. CIC-IDS2017.py +5 -4
CIC-IDS2017.py CHANGED
@@ -1,5 +1,5 @@
1
  import os
2
- import pandas as pd
3
  import datasets
4
 
5
  _CITATION = """\
@@ -56,9 +56,10 @@ class CICIDS2017(datasets.GeneratorBasedBuilder):
56
  ]
57
 
58
  def _generate_examples(self, filepath):
59
- df = pd.read_csv(filepath)
60
- for id_, row in df.iterrows():
 
61
  yield id_, {
62
  'flow_id': row['flow_id'],
63
  'attack_label': row['attack_label']
64
- }
 
1
  import os
2
+ import csv
3
  import datasets
4
 
5
  _CITATION = """\
 
56
  ]
57
 
58
  def _generate_examples(self, filepath):
59
+ with open(filepath, encoding="utf-8") as csv_file:
60
+ csv_reader = csv.DictReader(csv_file)
61
+ for id_, row in enumerate(csv_reader):
62
  yield id_, {
63
  'flow_id': row['flow_id'],
64
  'attack_label': row['attack_label']
65
+ }