コード例 #1
0
def main():
    file_name = input('Enter the csv file name: ')
    column_name = input('Enter the column name: ')

    df = convert_csv_file(file_name)
    if not column_name in df.columns:
        print('Error: the column {} is not in the file'.format(column_name))
        exit(-1)

    keys = get_keys(df, column_name)
    data_frame_to_csv(df, column_name, keys)

    compare_file_counts(['csv_files/'+str(name)+'.csv' for name in keys], [1]*len(keys))
コード例 #2
0
def main(file_name, filter_function, column):
    filter_function = get_filter_function(filter_function)
    df = convert_date_time.convert_csv_file(file_name)

    if filter_function is None:
        if not column in df.columns:
            print(
                'Error: The column specified does not exist in the dataframe')
            exit_with_usage(-1)
        write_data.data_frame_to_csv(df, column, None)

    else:
        filtered_df, filter_keys = filter_function(df)
        write_data.filtered_data_frame_to_csv(filtered_df, filter_keys)
コード例 #3
0
def main():
    file_name = input('Enter the csv file name: ')
    column_name = input('Enter the column name: ')

    df = convert_csv_file(file_name)
    if not column_name in df.columns:
        print('Error: the column {} is not in the file'.format(column_name))
        exit(-1)

    keys = get_keys(df, column_name)
    data_frame_to_csv(df, column_name, keys)

    compare_file_counts(['csv_files/' + str(name) + '.csv' for name in keys],
                        [1] * len(keys))