You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a function that saves a table as CSV, possibly adding the prefixes row.
Taken from TulipaClustering:
""" write_csv_with_prefixes(file_path, df; prefixes)Writes the dataframe `df` into a csv file at `file_path`. If `prefixes` areprovided, they are written above the column names. For example, these prefixescan contain metadata describing the columns."""functionwrite_csv_with_prefixes(file_path, df; prefixes =nothing, csvargs...)
ifisnothing(prefixes) ||length(prefixes) ==0# If there are no prefixes, just write the data frame into the file
CSV.write(file_path, df; strict =true, csvargs...)
else# Convert the prefixes to a one-row table for `CSV.write` to use
prefixes =reshape(prefixes, (1, length(prefixes))) |> Tables.table
# First we write the prefixes, then we append the data drom the dataframe
CSV.write(file_path, prefixes; header =false, strict =true, csvargs...)
CSV.write(file_path, df; header =true, append =true, strict =true, csvargs...)
endreturnnothingend
Motivation
No response
Target audience
No response
Can you help
No response
The text was updated successfully, but these errors were encountered:
Description
Create a function that saves a table as CSV, possibly adding the prefixes row.
Taken from TulipaClustering:
Motivation
No response
Target audience
No response
Can you help
No response
The text was updated successfully, but these errors were encountered: