1 + 2
import matplotlib.pyplot as plt import numpy as np import pandas as pd import scipy as sc import seaborn as sns
!pip install vega_datasets==0.9.0
Collecting vega_datasets==0.9.0 Downloading vega_datasets-0.9.0-py3-none-any.whl (210 kB) |████████████████████████████████| 210 kB 14.4 MB/s Requirement already satisfied: pandas in /shared-libs/python3.7/py/lib/python3.7/site-packages (from vega_datasets==0.9.0) (1.2.5) Requirement already satisfied: numpy>=1.16.5 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from pandas->vega_datasets==0.9.0) (1.19.5) Requirement already satisfied: pytz>=2017.3 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from pandas->vega_datasets==0.9.0) (2021.3) Requirement already satisfied: python-dateutil>=2.7.3 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from pandas->vega_datasets==0.9.0) (2.8.2) Requirement already satisfied: six>=1.5 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from python-dateutil>=2.7.3->pandas->vega_datasets==0.9.0) (1.16.0) Installing collected packages: vega-datasets Successfully installed vega-datasets-0.9.0 WARNING: You are using pip version 20.1.1; however, version 21.3.1 is available. You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.
# load an example dataset from vega_datasets import data cars = data.cars() # plot the dataset, referencing dataframe column names import altair as alt alt.Chart(cars).mark_bar().encode( x=alt.X('Miles_per_Gallon', bin=True), y='count()', )