Auswahl:
Upload csv
def sub(*args,**kwargs):
result_place = Element('output')
result_place.write(f"{Element('name').value} ist ausgewählt aus dem Land {Element('countries').value}")
import asyncio
import panel as pn
import pandas as pd
from panel.io.pyodide import show
from io import StringIO
#fileInput = pn.widgets.FileInput(accept='.csv')
#fileInput = pn.widgets.FileInput('http://majo2000.bplaced.net/python/gewst ges.csv')
#uploadButton = pn.widgets.Button(name='Upload', button_type = 'primary')
from pyodide.http import open_url
url_content = open_url("http://majo2000.bplaced.net/python/gewst ges.csv")
df = pd.read_csv(url_content)
fileInput = df
csv = Element('csv')
df = pd.DataFrame(df)
table = pn.widgets.Tabulator(pagination='remote', page_size=10)
def process_file(event):
if fileInput.value is not None:
table.value = pd.read_csv(io.BytesIO(fileInput.value))
document.getElementById('table').style.display = 'block'
#uploadButton.on_click(process_file)
def get_csv():
return io.BytesIO(table.value.to_csv().encode())
file_download_csv = pn.widgets.FileDownload(filename="data.csv", callback=get_csv, button_type="primary")
await show(fileInput, 'fileinput')
#await show(uploadButton, 'upload')
await show(table, 'table')
await show(file_download_csv, 'download')