plantcv icon indicating copy to clipboard operation
plantcv copied to clipboard

Save results in CSV format without overwriting the file

Open nfahlgren opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. plantcv.outputs.save_results will add data to an existing JSON file but it overwrites an existing CSV file. If you want to combine results from multiple PlantCV workflows, from multiple Jupyter notebooks for example, you currently need to save multiple CSV files and then combine them (@josectovar brought this to our attention).

Describe the solution you'd like We could open the CSV file with mode="a" (append) instead of overwrite. We would need to exclude the header if the file exists to avoid duplicating it when adding results. We would have to assume that new observations are named uniquely relative to data already in the output file.

Describe alternatives you've considered We could potentially read the existing data as a dataframe and append the new data as a dataframe and save the merged dataframe as CSV.

nfahlgren avatar Apr 18 '22 15:04 nfahlgren

Came up with one solution in #1225 but it needs some discussion

afinit avatar Jul 08 '23 21:07 afinit