Crate csv_stacker

Source
Expand description

Quick utility to vertically stack a bunch of CSV files with partially matching column headers.

Can be configured using Config.toml to define 3 parameters:

  1. csv_dir_path: the path to the directory where the csvs you want to stack are held.
  2. outfile: the filename to write the stacked csv out to.
  3. colnames: a list of column headers you want to select for in the stacked csv file.

Structs§

Config
Config struct representing a few config variables for the app.

Functions§

build_df_vec
Takes a Vec of csv filename strings and returns a Vec of LazyFrames.
colnames
Reads a plain text file with lines containing the column names desired to be selected for the final stacked CSV.
csv_filenames
Lists all CSV files in the csv_dir_path argument directory and returns the list as a Vec.
read_single_csv
Reads one CSV file into a Polars LazyFrame.
run
Main function to run the crate binary.
stack_dfs
Takes a Vec of individual dataframes and returns a stacked dataframe, with columns selected from the colnames argument.