I have a csv file with 3 fields. I want to create a json file based on the table custom format. I want to use the json file in dash cytoscape.
I have tried to use pandas as a data frame and change the data frame to a json format. I sawthis question. Beacause of the different json format different this question i could not use the answer. CSV table:
DISTRICT,MONTH
B2,2
A7,5
A1,9
...
I want to convert the table to json with the below format:
[ {'data': {'id': 'B2', 'label': 'B2'}},
{'data': {'id': 'A7', 'label': 'A7'}},
{'data': {'id': 'A1', 'label': 'A1'}},
{'data': {'id': '2', 'label': '2'}},
{'data': {'id': '5', 'label': '5'}},
{'data': {'id': '9', 'label': '9'}},
{'data': {'source': 'B2', 'target': '2'}},
{'data': {'source': 'A7', 'target': '5'}},
{'data': {'source': 'A1', 'target': '9'}}
]