How to read multiple column CSV by changing headers into categories and all values into one column?

Viewed 20

I want to create a multiple-line chart in d3.js, the data is in csv and is organized as follows:

¦Date      ¦ Cat A¦ Cat B¦ Cat C¦  
¦:---------¦:----:¦:----:¦-----:¦  
¦2019-12-01¦2     ¦6     ¦9     ¦  
¦2018-11-02¦4     ¦4     ¦20    ¦ 

How do I read the data to be arranged into three columns:

¦Date      ¦ Category¦ value ¦  
¦:---------¦:-------:¦------:¦  
¦2019-12-01¦CAT A    ¦2      ¦  
¦2018-11-02¦CAT A    ¦4      ¦  
¦2019-12-01¦CAT B    ¦6      ¦  
¦2018-11-02¦CAT B    ¦9      ¦  

Please note that I would like to ignore one of the columns (CAT C)

0 Answers
Related