Is there a way to send
DataFrames of different lengths to a CSV file, so that when I open them in Excel, they would appear side by side?
Or is there simply a way to create a single
DataFrame with varying column lengths, so I can just send that to the CSV file?
Right now what I’m doing is just using the
append kwarg and stacking one dataframe over the other, which isn’t very pretty or convenient. If there is a solution to this please let me know, thanks!
Hmmm…this is a pretty non-standard operation; I’m not aware of any way you could do this (in any language, not just Julia).
The DataFrames package tries very hard to ensure column lengths are consistent, since it affects many operations: grouping, sorting, indexing, etc.
Part of the issue of what you’re requesting is that the csv file format is row-based, while DataFrames are columnar, which makes it a bit awkward to consider writing out multiple DataFrames side-by-side by rows.
What you can do is adding rows full of
missing to the shorter data frame(s) using
append!, and then concatenate the data frames into a single one using
Ah alright that makes sense, and yeah I did realise that it probably wouldn’t be possible, but I just wanted to check. Thanks for the explanation!