In [7]:
import pandas as pd
df = pd.read_json('cars.json')
In [8]:
df[:10]
Out[8]:
In [9]:
from vega import VegaLite
In [10]:
VegaLite({
"mark": "point",
"encoding": {
"y": {"type": "quantitative","field": "Acceleration"},
"x": {"type": "quantitative","field": "Horsepower"}
}
}, df)
In [11]:
VegaLite({
"description": "A scatterplot showing horsepower and miles per gallons.",
"mark": "point",
"encoding": {
"x": {"field": "Horsepower", "type": "quantitative"},
"y": {"field": "Miles_per_Gallon", "type": "quantitative"},
"color": {"field": "Origin", "type": "nominal"},
"shape": {"field": "Origin", "type": "nominal"}
}
}, df)
In [ ]: