Load on click
We will load dataset on button click in this example. Data is loaded only when button is clicked.
You will need
mercury packages to run this example.
In the first cell, please import required packages:
import pandas as pd import mercury as mr
load = mr.Button(label="Load data")
We will define variable to keep reference to dataset:
df = None
We will load data when button is clicked:
if load.clicked: df = pd.read_csv("https://raw.githubusercontent.com/pplonski/datasets-for-start/master/adult/data.csv")
We display data in the last cell:
df.head() if df is not None else print("Data not loaded")
The screenshot of the notebook's code in the Jupyter Notebook:
Please start Mercury in the same directory as notebook:
You will see the app running at
http://127.0.0.1:8000. Below is an animation with Mercury App.