From 7ea61e7e1f0cd2dda2b7e0b18b1b948cd4ba0f1a Mon Sep 17 00:00:00 2001 From: Maciej Sobkowiak Date: Wed, 12 May 2021 20:18:46 +0200 Subject: [PATCH] Read data from files --- bayes2.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/bayes2.py b/bayes2.py index 008b9b6..85c6dd3 100644 --- a/bayes2.py +++ b/bayes2.py @@ -1,18 +1,23 @@ import pandas as pd +import numpy as np import gzip dev = pd.read_table('dev-0/in.tsv', error_bad_lines=False, header=None) test = pd.read_table('test-A/in.tsv', error_bad_lines=False, header=None) -print(dev) +X_train = [] +y_train = [] -train_y = [] -train_X = [] with gzip.open('train/train.tsv.gz', 'r') as f: for l in f: line = l.decode('UTF-8').replace("\n", "").split("\t") - train_y.append(line[0]) - train_X.append(''.join(line[1:])) + y_train.append(line[0]) + X_train.append(line[1:]) -print(train_y[1:20]) -print(train_X[1:3]) +X_train = np.asanyarray(X_train) +y_train = np.asanyarray(y_train) + +X_dev = dev[0].values +X_test = test[0].values + +print(X_dev)