Spaces:
Running
Running
center text and table of last table
Browse files
main.py
CHANGED
@@ -475,25 +475,6 @@ new_dataset_comparison1 = pd.DataFrame(
|
|
475 |
}
|
476 |
)
|
477 |
|
478 |
-
|
479 |
-
# # Apply table styling: Light green for the header, alternating white and light grey for rows
|
480 |
-
# styled_table = (
|
481 |
-
# new_dataset_comparison1.style.set_properties(
|
482 |
-
# **{"background-color": "#E1EEDB"},
|
483 |
-
# subset=pd.IndexSlice[0, :], # Row 0 with a light green background
|
484 |
-
# )
|
485 |
-
# .apply(
|
486 |
-
# lambda x: [
|
487 |
-
# "background-color: #E1EEDB" # Green background for row 0
|
488 |
-
# if i == 0
|
489 |
-
# else "background-color: rgb(237, 242, 251)" # Blue background for other rows
|
490 |
-
# for i in range(len(x))
|
491 |
-
# ],
|
492 |
-
# axis=0,
|
493 |
-
# )
|
494 |
-
# .hide(axis="index")
|
495 |
-
# ) # Hide the row index
|
496 |
-
|
497 |
styled_table = (
|
498 |
new_dataset_comparison1.style.applymap(
|
499 |
lambda _: "background-color: #E1EEDB", # Green background for col 1
|
@@ -768,15 +749,22 @@ dataset_sources = pd.DataFrame(
|
|
768 |
}
|
769 |
)
|
770 |
# Apply table styling: Light green for the header, alternating white and light grey for rows
|
771 |
-
styled_table =
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
780 |
|
781 |
table_html_data = styled_table._repr_html_()
|
782 |
# table_html_data = dataset_sources.to_html(index=False, border=0)
|
|
|
475 |
}
|
476 |
)
|
477 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
478 |
styled_table = (
|
479 |
new_dataset_comparison1.style.applymap(
|
480 |
lambda _: "background-color: #E1EEDB", # Green background for col 1
|
|
|
749 |
}
|
750 |
)
|
751 |
# Apply table styling: Light green for the header, alternating white and light grey for rows
|
752 |
+
styled_table = (
|
753 |
+
dataset_sources.style.apply(
|
754 |
+
lambda x: [
|
755 |
+
"background-color: white"
|
756 |
+
if i % 2 == 0
|
757 |
+
else "background-color: rgb(237, 242, 251)"
|
758 |
+
for i in range(len(x))
|
759 |
+
],
|
760 |
+
axis=0,
|
761 |
+
)
|
762 |
+
.set_properties(**{"text-align": "center"}) # Center the text in all cells
|
763 |
+
.set_table_styles(
|
764 |
+
[{"selector": "table", "props": [("margin-left", "auto"), ("margin-right", "auto")]}] # Center the table on the page
|
765 |
+
)
|
766 |
+
.hide(axis="index") # Hide the row index
|
767 |
+
)
|
768 |
|
769 |
table_html_data = styled_table._repr_html_()
|
770 |
# table_html_data = dataset_sources.to_html(index=False, border=0)
|