Repository navigation
Add WriteCsv plus unit tests. - #2947
Conversation
pgovind
left a comment
There was a problem hiding this comment.
Apologies for the late review. I left some comments now :)
Do not worry. I'm sure you guys are very busy with .NET 5 :) |
| var record = new StringBuilder(); | ||
|
|
||
| bool firstRow = true; | ||
| foreach (var cell in row) |
There was a problem hiding this comment.
(minor perf question/suggestion): I wonder if we used the IDataView API here we could avoid the boxing and unboxing of every primitive value in the DataFrame.
For example, for each column, we can get a Getter and use it to get the value generically and write it to the StringBuilder.
See https://github.com/dotnet/machinelearning/blob/5370692f6d1e6f1f686596d530032b4226dc9e80/src/Microsoft.ML.Data/DataDebuggerPreview.cs#L44-L60 for a general structure on how to do this.
I think what we have here is good for a first implementation to get the functionality added. But we may want to benchmark alternatives to see how well this performs.
eerhardt
left a comment
There was a problem hiding this comment.
I think this is pretty close. After a couple minor nits I think we can merge this.
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
pgovind
left a comment
There was a problem hiding this comment.
Just the 1 comment to rename a var. Everything else looks really good! Great work!
Thank you everyone for all the help! :) |
I added WriteCsv method (plus some unit tests) to write a DataFrame to CSV file. This solves #2917.
@eerhardt @pgovind I have recreated the PR following Eric's recommendations from #2945. Please review.