A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://nbviewer.org/github/pandas-dev/pandas/blob/main/doc/source/user_guide/style.ipynb below:

Jupyter Notebook Viewer

# Hidden cell to just create the below example: code is covered throughout the guide.
s = (
    df.style.hide([("Random", "Tumour"), ("Random", "Non-Tumour")], axis="columns")
    .format("{:.0f}")
    .set_table_styles(
        [
            {"selector": "", "props": "border-collapse: separate;"},
            {"selector": "caption", "props": "caption-side: bottom; font-size:1.3em;"},
            {
                "selector": ".index_name",
                "props": "font-style: italic; color: darkgrey; font-weight:normal;",
            },
            {
                "selector": "th:not(.index_name)",
                "props": "background-color: #000066; color: white;",
            },
            {"selector": "th.col_heading", "props": "text-align: center;"},
            {"selector": "th.col_heading.level0", "props": "font-size: 1.5em;"},
            {"selector": "th.col2", "props": "border-left: 1px solid white;"},
            {"selector": ".col2", "props": "border-left: 1px solid #000066;"},
            {"selector": "td", "props": "text-align: center; font-weight:bold;"},
            {"selector": ".true", "props": "background-color: #e6ffe6;"},
            {"selector": ".false", "props": "background-color: #ffe6e6;"},
            {"selector": ".border-red", "props": "border: 2px dashed red;"},
            {"selector": ".border-green", "props": "border: 2px dashed green;"},
            {"selector": "td:hover", "props": "background-color: #ffffb3;"},
        ]
    )
    .set_td_classes(
        pd.DataFrame(
            [
                ["true border-green", "false", "true", "false border-red", "", ""],
                ["false", "true", "false", "true", "", ""],
            ],
            index=df.index,
            columns=df.columns,
        )
    )
    .set_caption("Confusion matrix for multiple cancer prediction models.")
    .set_tooltips(
        pd.DataFrame(
            [
                [
                    "This model has a very strong true positive rate",
                    "",
                    "",
                    "This model's total number of false negatives is too high",
                    "",
                    "",
                ],
                ["", "", "", "", "", ""],
            ],
            index=df.index,
            columns=df.columns,
        ),
        css_class="pd-tt",
        props="visibility: hidden; "
        "position: absolute; z-index: 1; "
        "border: 1px solid #000066;"
        "background-color: white; color: #000066; font-size: 0.8em;"
        "transform: translate(0px, -24px); padding: 0.6em; border-radius: 0.5em;",
    )
)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4