Spaces:
Sleeping
Sleeping
File size: 2,143 Bytes
62fa030 df99924 62fa030 e0a2165 62fa030 df99924 62fa030 aff437f df99924 62fa030 df99924 62fa030 df99924 62fa030 df99924 62fa030 df99924 62fa030 df99924 62fa030 df99924 62fa030 df99924 62fa030 df99924 62fa030 df99924 62fa030 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
import pandas as pd
import panel as pn
import numpy as np
from bokeh.models.widgets.tables import NumberFormatter, BooleanFormatter
pn.extension("tabulator")
### Beispiel DataFrame
df = pd.read_pickle(f"cossims_plural_slicewidth=1.pkl")
if "boson" in df.index:
df = df.drop("boson")
if "bosons" in df.index:
df = df.drop("bosons")
if "boson_s" in df.index:
df = df.drop("boson_s")
df["sum"] = df.sum(axis=1)
df = df.loc[:, 1948:] #1948
#df = df.fillna(0).round(3)
df = df.sort_values("sum", ascending=False)
df = df.head(20)
df.index.name = "token"
outpath = "../results/bosons/cossims_plural_bosons.html"
### functionality
#tabulator_formatters = {"token" : {"title": "token", "type" : "textarea"}} # Formatiert die Zellen
cell_formatters = {col : NumberFormatter(format='0.000') for col in df.columns} # Formatiert die Zellen
header_filters={'token': {'type': 'input', 'func': 'like', 'placeholder': 'search'}} # Für Suche, etc.
### style
theme = "modern" # 'default', 'site', 'simple', 'midnight', 'modern', 'bootstrap', 'bootstrap4', 'materialize', 'bulma', 'semantic-ui', or 'fast'
page_size = 50 # Number of rows
page = 1 # Start on page x
#configuration={"rowHeight" : 10*24}
#widths = {'index' : 40} or {'index': '5%'}
#frozen_rows = list
#frozen_columns = list
tabs = pn.widgets.Tabulator(
df,
### functionality
formatters= cell_formatters, #tabulator_formatters,
header_filters = header_filters,
selectable="toggle",
### style
theme = theme,
page_size = page_size,
page = page,
frozen_columns = {"token" : "left", "sum" : "right"}, # Must give width, otherwise doesn't work!
width=1800,
height=950,
#frozen_rows = [1],
#widths
#configuration = configuration,
### other
disabled = True # Whether the cells are editable
)
ACCENT = "teal"
pn.template.FastListTemplate(
#title="Wind Turbine Dashboard",
#sidebar=[image, t_manu, p_year],
#main=[pn.Column(indicators, tabs, sizing_mode="stretch_both")],
main=[pn.Column(tabs, sizing_mode="stretch_both")],
#main_layout=None,
accent=ACCENT,
).servable() |