framian
framian copied to clipboard
Save a Frame to CSV
Perhaps I missed it, but I couldn't see an easy way to do this. It would obviously be very useful.
I've been playing some more with this, and came up with the following, for converting a Frame, df:
Csv.fromFrame(new CsvFormat(",", header = true))(df).toString
which seems as though it ought to work. However, there's a problem with it. The initial header row is output with field names in the same order that they occur in the Frame. However, the actual data rows for some frames have their elements ordered differently to the order in which they occur in the data frame. The result is then a mismatch between the ordering of the header items and the data items, which is obviously a bad thing.
Is this a bug in the library somewhere?
I have seen the same issue, but I could not narrow down where the bug is occurring. It's interesting because calling .toString on the Frame does not result in the same error.
Interesting - I suspect we are using the wrong index iteration order somewhere... I'll check it out