def main():
    #print('LOG: Main program to run tests')

    parser = argparse.ArgumentParser(description='Remove the final column')
    parser.add_argument('file_path_in',
                        type=str,
                        help='full path to input file')
    parser.add_argument('file_path_out',
                        type=str,
                        help='full path to output file')
    parser.add_argument('columns',
                        nargs='+',
                        type=int,
                        help='the columns to remove')
    args = parser.parse_args()
    columns = args.columns
    columns = sorted(columns, reverse=True)
    print('deleting these columns in this order')
    print(columns)

    data = FileManager.get_csv_file_data_numpy(args.file_path_in, ',')
    for column in columns:
        data = np.delete(data, column, axis=1)
    data_as_numbers = data.astype(np.float)

    np.savetxt(args.file_path_out, data_as_numbers, delimiter=',')
    '''
def main():
    #Move class column to final col

    parser = argparse.ArgumentParser(description='Normalize the data')
    parser.add_argument('file_path_in',
                        type=str,
                        help='full path to input file')
    parser.add_argument('file_path_out',
                        type=str,
                        help='full path to output file')
    args = parser.parse_args()

    #read in data, normalize, save to file
    data = FileManager.get_csv_file_data_numpy(args.file_path_in)
    data = data.astype(np.float)
    min_max_scaler = preprocessing.MinMaxScaler()
    normalized_data = min_max_scaler.fit_transform(data)
    print(normalized_data)
    np.savetxt(args.file_path_out, normalized_data, delimiter=',')
Example #3
0
def main():
    #Move class column to final col

    parser = argparse.ArgumentParser(
        description='Move the given column to be the last column')
    parser.add_argument('file_path_in',
                        type=str,
                        help='full path to input file')
    parser.add_argument('column', type=int, help='the column to remove')
    parser.add_argument('file_path_out',
                        type=str,
                        help='full path to output file')
    args = parser.parse_args()
    column = args.column

    data = FileManager.get_csv_file_data_numpy(args.file_path_in, ',')
    data = data.astype(np.float)

    data_as_np = DataManipulator.move_np_column_to_end(data, column)
    np.savetxt(args.file_path_out, data_as_np, delimiter=',')
    '''