Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

c# DataTable to dict multiple column (ex. python dataframe.to_dict("record"))

I’m using c# DataTable.

DataTable has the following format.

col1 col2 col3 col4 ...
a    b    c    d    ...
aa   bb   cc   dd   ...
...  ...  ...  ...

And the dictionary format I want is as follows.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

{"col1":a, "col2":b, "col3":c, "col4":d, ...}, {"col1":aa, "col2":bb, "col3":cc, "col4":dd, ...}, ...

How can I convert like above?

In the case of python, conversion is easily possible using the dataframe.to_dict(‘record’) function.

Thanks in advance for your reply.

>Solution :

You could use a simpler, less complex method like the following post suggests. https://stackoverflow.com/a/55856220/14459189

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading