-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpreprocessing.py
More file actions
23 lines (17 loc) · 883 Bytes
/
preprocessing.py
File metadata and controls
23 lines (17 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import numpy as np
import pandas as pd
def convertToNpArray(train,test):
train_data = pd.read_csv(train,delimiter=',', quotechar='"',
dtype=None,encoding = "ISO-8859-1",
usecols=['Sentiment','SentimentText'])
train_target = train_data[['Sentiment']]
train_target_array = np.array(train_target)
train_data = train_data[['SentimentText']]
train_data_array = np.array(train_data)
test_data = pd.read_csv(test,delimiter=',', quotechar='"',
dtype=None,encoding = "ISO-8859-1",
usecols=['SentimentText'])
test_data_array = np.array(test_data)
return train_data_array,train_target_array,test_data_array
if __name__=="__main__":
train_data_array, train_target_array, test_data_array=convertToNpArray('data/train.csv','data/test.csv')