Skip to content

Instantly share code, notes, and snippets.

View jsignell's full-sized avatar
🌴
On vacation

Julia Signell jsignell

🌴
On vacation
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def look_for_class(panel, classname, items=None):
"""
Descend a panel object and find any instances of the given class
"""
if items is None:
items = []
if isinstance(panel, pn.layout.ListPanel):
for p in panel:
items = look_for_class(p, classname, items)
elif isinstance(panel, classname):
def make_dynamic(func):
from collections import defaultdict
from types import FunctionType
import param
try:
import panel as pn
panel_available = True
except:
panel_available = False
@jsignell
jsignell / intake_live_demo.md
Last active July 10, 2019 21:53
Intake: Basta with the Copy Pasta

Intake: Basta with the Copy Pasta

conda create --name lightning-talk intake
conda activate lightning-talk
conda install -c intake us_crime
ipython

Import intake, inspect the metadata on your data source

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import panel as pn
pn.extension()
labels = [t[0] + t[1] + t[2] for t in zip('abcdefghijklmnopqrstuvwxyz','bcdefghijklmnopqrstuvwxyza', 'cdefghijklmnopqrstuvwxyzab')]
options = dict(zip(labels, range(len(labels))))
multi = pn.widgets.MultiSelect(options=options)
sort = pn.widgets.Button(name='▼', width=40)
filt = pn.widgets.AutocompleteInput(options=list(options.keys()), placeholder='Filter')
import panel as pn
pn.extension()
labels = [t[0] + t[1] + t[2] for t in zip('abcdefghijklmnopqrstuvwxyz','bcdefghijklmnopqrstuvwxyza', 'cdefghijklmnopqrstuvwxyzab')]
options = dict(zip(labels, range(len(labels))))
multi = pn.widgets.MultiSelect(options=options)
sort = pn.widgets.Button(name='▼', width=40)
filt = pn.widgets.AutocompleteInput(options=list(options.keys()), placeholder='Filter')
import os
from collections import OrderedDict
import panel as pn
path = os.getcwd()
down = '│'
right = '└──'
def expand_dir(event):
@jsignell
jsignell / custom_plotting.ipynb
Created March 21, 2019 20:35
Custom Plotting using Intake, hvplot, and panel
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jsignell
jsignell / panel_file_browser.py
Last active March 20, 2019 19:41
Multipane File Browser implemented in Panel
import os
import panel as pn
path = os.getcwd()
def get(event):
"""When dir selected populate next pane, remove any extra panes"""
got = event.new[0]
if os.path.isdir(got):
items = sorted(os.listdir(got))