Modify script

This commit is contained in:
Norbert Litkowski 2021-05-18 22:54:16 +02:00
parent 3ebd13aca1
commit f975a3e735
3 changed files with 2004 additions and 2003 deletions

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@ def get_train_data(names: list):
train_path = os.path.join(MAIN_DIR, TRAIN_DIR, TRAIN_FILE_NAME)
check_file(train_path)
train_data = process_input(pandas.read_csv(
train_path, header=None, sep=VALUE_SEP, names=names))
train_path, header=None, sep=VALUE_SEP, names=names), names)
train_data = train_data.loc[(train_data[names[0]] > 1000)]
@ -42,10 +42,11 @@ def get_train_data(names: list):
def get_input_data(dirname, names):
in_path = os.path.join(dirname, IN_FILE_NAME)
check_file(in_path)
return process_input(pandas.read_csv(in_path, header=None, sep=VALUE_SEP, names=names[1:]))
return process_input(pandas.read_csv(in_path, header=None, sep=VALUE_SEP, names=names[1:]), names)
def process_input(df):
def process_input(df, names):
df = df.drop([names[4]], axis=1)
for c in df.select_dtypes(include=object).columns.values:
df[c] = df[c].astype(CATEGORY_TYPE).cat.codes
return df

File diff suppressed because it is too large Load Diff