Calmcode - ipywidgets: display

Display

1 2 3 4 5 6 7 8

You can also make components that query text using ipywidgets. Just make sure you use display when you're interested in showing dataframes.

import pandas as pd
import ipywidgets as widgets

df = pd.read_json("https://calmcode.io/datasets/pokemon.jsonl",
                  lines=True,
                  orient="record")

def reduce(q):
    subset = df.loc[lambda d: d['name'].str.contains(q)]
    display(subset)

q = widgets.Text()

out = widgets.interactive_output(reduce, {'q': q})

widgets.VBox([q, out])