def read_dataset(dataset_metadata):
dataset_filename = dataset_metadata["<STR_LIT:filename>"]<EOL>target_class_name = dataset_metadata["<STR_LIT>"]<EOL>index_col_name = dataset_metadata.get("<STR_LIT>", None)<EOL>column_types = dataset_metadata.get("<STR_LIT>", None)<EOL>dataset_path = get_dataset_path(dataset_filename)<EOL>ext = dataset_path.split("<STR_LIT:.>")[-<NUM_LIT:1>]<EOL>if ext == "<STR_LIT>":<EOL><INDENT>dataframe = _read_arff_dataset(dataset_path)<EOL><DEDENT>elif ext == "<STR_LIT>":<EOL><INDENT>dataframe = _read_csv_dataset(dataset_path, index_col_name)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>".format(ext))<EOL><DEDENT>X = dataframe.drop(columns=[target_class_name], axis=<NUM_LIT:1>)<EOL>Y = dataframe[target_class_name]<EOL>return X, Y, column_types<EOL>
Loads a csv or arff file (provided they are named *.{csv|arff})