I have some (up to 200) one-dimensional numerical arrays, all doubles, created by my program. I need to output them to a CSV or to an Excel file. Specifically, I need to create a table, where each array is a column, and the headings are text descriptions. The arrays describe the attributes of certain items. All items have the same attributes.
The arrays are the result of a numerical simulation script which I had coded in Python and am now trying to convert to C# because Python is too slow.
In Python I use a pandas dataframe to store all these columns and their headings. How could I do it in C#? Could I use a library like http://www.extremeoptimization.com/ or http://bluemountaincapital.github.io/Deedle/ to create something similar to a dataframe? Commercial, not-free libraries are fine.
In Python I created a class which defines each of the item I am modelling. Say I am modelling 10 cars, I would create 10 instances of the class Car; each class would contain a string with the description to be used in the headings of the final output, the definition of the one-dimensional arrays, and a method which creates a dataframe with all the arrays. I then loop through this method for each of the cars to create the final output table, so that the he headings will be something like:
- "long description of Item 1 - attribute A"
- "long description of Item 1 - attribute B"
- ...
- "long description of Item 2 - attribute B"
etc.
Any tip would be most welcome. Thanks a lot!
partially my solution, not good enough, but works :
using :
in your case - try csv :