
Hi!
After the event “Building an Anomaly Detector System with a few or no lines of code” at MsftReactor, some people asked for the 2 lines that I used to convert a CSV file to JSON, to be used with Cognitive Services Anomaly Detector, so here they are.
Important: you need Newtonsoft.Json to build the json content.
The input CSV is part of the Machine Learning.Net sample data, and has this sample content:
Month,ProductSales
1-Jan,271
2-Jan,150.9
3-Jan,188.1
...
And as a bonus, the full console project can be downloaded from here.
https://github.com/elbruno/Blog/tree/master/20191125%20CSV%20to%20JSON%20for%20Anomaly%20Detector
This project also have a second function which creates the JSON content using simple string, without the need of Newtonsoft.Json.
Happy coding!
Greetings @ Burlingon
El Bruno
References
- Event – Resources used during my session “Building an Anomaly Detector System with a few or no lines of code” @MsftReactor https://elbruno.com/2019/11/22/event-resources-used-during-my-session-building-an-anomaly-detector-system-with-a-few-or-no-lines-of-code-msftreactor/
- Anomaly Detector https://azure.microsoft.com/en-us/services/cognitive-services/anomaly-detector
- Machine Learning .Net Samples http://aka.ms/mlnetsamples
- Newtonsoft Json, create JSON Manually https://www.newtonsoft.com/json/help/html/CreateJsonManually.htm
1 comment