# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3 (ipykernel)
#     language: python
#     name: python3
# ---

spec_no_data = {
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {"name": "data"},
  "mark": "bar",
  "encoding": {
    "x": {"aggregate": "sum", "field": "yield"},
    "y": {"field": "variety"},
    "color": {"field": "site"}
  }
}
from vega.widget import VegaWidget
import requests
import json
req = requests.get("https://raw.githubusercontent.com/vega/vega/master/docs/data/barley.json")
values = json.loads(req.text)
#data
widget = VegaWidget(spec=spec_no_data)
display(widget)
# %time widget.update('data', insert=values)

import pandas as pd
URL = "https://forge.scilab.org/index.php/p/rdataset/source/file/368b19abcb4292c56e4f21079f750eb76b325907/csv/lattice/barley.csv"
df = pd.read_csv(URL)
widget = VegaWidget(spec=spec_no_data)
display(widget)
# %time widget.update("data", insert=df)

import pandas as pd
URL = "https://forge.scilab.org/index.php/p/rdataset/source/file/368b19abcb4292c56e4f21079f750eb76b325907/csv/lattice/barley.csv"
df = pd.read_csv(URL)
widget = VegaWidget(spec=spec_no_data)
widget.compression = 'zlib'
display(widget)
# %time widget.update('data', insert=df)

import pandas as pd
from ipytablewidgets import LZ4Compressor
URL = "https://forge.scilab.org/index.php/p/rdataset/source/file/368b19abcb4292c56e4f21079f750eb76b325907/csv/lattice/barley.csv"
df = pd.read_csv(URL)
widget = VegaWidget(spec=spec_no_data)
widget.compression = LZ4Compressor(2)
display(widget)
# %time widget.update('data', insert=df)

StarcoderdataJupyterScriptsDedupFiltered