-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUNSWNB15_Data.py
More file actions
25 lines (17 loc) · 915 Bytes
/
Copy pathUNSWNB15_Data.py
File metadata and controls
25 lines (17 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import pandas as pd
import time
class UNSWNB15:
# Construct an object that will prepare data into different input formats
# Create predictor matrix
def makeUNSW(self):
#train = pd.read_csv(r'C:/Users/Owner/OneDrive/Documents\Muu/Coursera/Plan B Thesis/UNSW/UNSW_NB15_training-set.csv')
#test = pd.read_csv(r'C:/Users/Owner/OneDrive/Documents\Muu/Coursera/Plan B Thesis/UNSW/UNSW_NB15_testing-set.csv')
## For reading data in Ubuntu
train = pd.read_csv('UNSW_NB15_training-set.csv')
test = pd.read_csv('UNSW_NB15_testing-set.csv')
fulldata = pd.concat([train, test])
## Categorical data type
fulldata['proto'] = fulldata['proto'].astype(object)
fulldata['service'] = fulldata['service'].astype(object)
fulldata['state'] = fulldata['state'].astype(object)
return fulldata