To create a JSON of your data that can be used in vega-lite, you can use python pandas to_json function with the 'records' orientation:
import pandas as pd
inputFile = "/path/to/csvs/inputfile.csv"
outputFile = "/path/to/output/ourputfile.json"
df = pd.DataFrame()
df = pd.read_csv(inputFile)
df.to_json(outputFile,orient="records")
Then, enter the data into vega-lite as in:
{
//...
"data": {
"values": // [enter json output from pandas here] e.g.,
{
"Group": "Overall",
"Subset": "Overall",
"Task-orientation": "Socially oriented",
"Count": 38
},
{
"Group": "Overall",
"Subset": "Overall",
"Task-orientation": "Task-oriented",
"Count": 115
},
// ...
}
}
Note that on the online vega-lite editor, you can directly get the SVG by copying the element in the inspector and pasting it into a text doc with the extension .svg
.