From 0a6aa25f49109f6dbd4c7244213e07155cc25bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20=C5=81ukasiewicz?= Date: Thu, 20 Apr 2023 14:25:37 +0200 Subject: [PATCH] Dodanie 'z434743-create-dataset.py' --- z434743-create-dataset.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 z434743-create-dataset.py diff --git a/z434743-create-dataset.py b/z434743-create-dataset.py new file mode 100644 index 0000000..90dcfa9 --- /dev/null +++ b/z434743-create-dataset.py @@ -0,0 +1,26 @@ +import pandas +import os +from sklearn.model_selection import train_test_split + + +CUTOFF = int(os.environ['CUTOFF']) + +movies = pandas.read_csv('./ium_z434743/rotten_tomatoes_movies.csv', + engine='python', + encoding='ISO-8859-1', + sep=',') + +movies = movies.dropna() + + +movies = movies.sample(CUTOFF) + +X, Y = movies, movies + + +X_train, X_temp, Y_train, Y_temp = train_test_split(X, Y, test_size=0.3, random_state=1) +X_dev, X_test, Y_dev, Y_test = train_test_split(X_temp, Y_temp, test_size=0.3, random_state=1) + +X_train.to_csv('X_train.csv', index=False) +X_dev.to_csv('X_dev.csv', index=False) +X_test.to_csv('X_test.csv', index=False)