file loading fix

This commit is contained in:
Kacper Dudzic 2022-04-29 18:46:18 +02:00
parent 18f80de958
commit 9e2ef895ff

8
run.py
View File

@ -7,10 +7,14 @@ train_file = sys.argv[1]
pred_file = sys.argv[2] pred_file = sys.argv[2]
train = pd.read_csv(train_file, sep='\t', header=None) train = pd.read_csv(train_file, sep='\t', header=None)
pred_x = pd.read_csv(pred_file, sep='\t', header=None) #pred_x = pd.read_csv(pred_file, sep='\t', header=None)
pred_x = []
with open(pred_file, encoding='utf-8') as f:
for line in f:
pred_x.append(line)
train_x, train_y = train[4], train[0] train_x, train_y = train[4], train[0]
#pred_x = pred[4] #pred_x = pred[4]
pred_x = pred_x.stack() #pred_x = pred_x.stack()
vectorizer = TfidfVectorizer() vectorizer = TfidfVectorizer()
train_x = vectorizer.fit_transform(train_x) train_x = vectorizer.fit_transform(train_x)