simple helper functions for reading and saving CSV files

modulus.csv_utils.csv_rw.csv_to_dict(filename, mapping=None, delimiter=',')

reads a csv file to a dictionary of columns


The file name to load from

mappingNone, dict

If None load entire csv file and store every column as a key in the dict. If mapping is not none use this to map keys from CSV to keys in dict.

delimiter: str

The string used for separating values.

datadict of numpy arrays

numpy arrays have shape [N, 1].

modulus.csv_utils.csv_rw.dict_to_csv(dictonary, filename)

saves a dict of numpy arrays to csv file


dictionary of numpy arrays. The numpy arrays have a shape of [N, 1].


The file name to save too

© Copyright 2021-2022, NVIDIA. Last updated on Mar 29, 2023.