plantcv
plantcv copied to clipboard
Save results in CSV format without overwriting the file
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.
Came up with one solution in #1225 but it needs some discussion