Spaces:
Sleeping
Sleeping
Upload components.py
Browse files- components.py +18 -0
components.py
CHANGED
|
@@ -599,3 +599,21 @@ def computation_view(data: pd.DataFrame, models_to_plot: set[str]):
|
|
| 599 |
fig.update_xaxes(title_text="Available historical observations (#)")
|
| 600 |
fig.update_yaxes(title_text="CPU usage (hours)")
|
| 601 |
st.plotly_chart(fig, use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 599 |
fig.update_xaxes(title_text="Available historical observations (#)")
|
| 600 |
fig.update_yaxes(title_text="CPU usage (hours)")
|
| 601 |
st.plotly_chart(fig, use_container_width=True)
|
| 602 |
+
|
| 603 |
+
st.divider()
|
| 604 |
+
|
| 605 |
+
cpu_per_building_table = (
|
| 606 |
+
data_to_plot.pivot(index="model", columns="unique_id", values="resource_usage.CPU")
|
| 607 |
+
)
|
| 608 |
+
|
| 609 |
+
def custom_table(styler: Styler):
|
| 610 |
+
styler.background_gradient(cmap="seismic", axis=None)
|
| 611 |
+
styler.format(precision=2)
|
| 612 |
+
|
| 613 |
+
# center text and increase font size
|
| 614 |
+
styler.map(lambda x: "text-align: center; font-size: 14px;")
|
| 615 |
+
return styler
|
| 616 |
+
|
| 617 |
+
st.markdown(f"#### Computational time per building")
|
| 618 |
+
styled_table = cpu_per_building_table.style.pipe(custom_table)
|
| 619 |
+
st.dataframe(styled_table, use_container_width=True)
|