Skip to content

Commit

Permalink
artifacts for avoiding deprecated gt arguments
Browse files Browse the repository at this point in the history
for #1317
  • Loading branch information
gordonwoodhull committed Nov 15, 2024
1 parent 5c92c78 commit dcfe856
Show file tree
Hide file tree
Showing 17 changed files with 89 additions and 297 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"hash": "ead4c2e1e06e77e4d6e2ea986e264c20",
"result": {
"engine": "jupyter",
"markdown": "---\ntitle: \"Pandas - Acting on Data\"\nformat: \n typst: default\n html:\n format-links: false\n theme: default\nbibliography: []\nreferences:\n - type: website\n id: pandas-user-guide\n url: https://pandas.pydata.org/pandas-docs/version/2.2.2/user_guide/style.html#Acting-on-the-Index-and-Column-Headers\n---\n\n```{=typst}\n#set page(numbering: none)\n```\n\n::: {#8e7d7d5f .cell .plain execution_count=1}\n``` {.python .cell-code}\nimport pandas as pd\nimport numpy as np\n\nnp.random.seed(0)\ndf2 = pd.DataFrame(np.random.randn(10,4), columns=['A','B','C','D'])\n\ndef style_negative(v, props=''):\n return props if v < 0 else None\ns2 = df2.style.map(style_negative, props='color:red;')\\\n .map(lambda v: 'opacity: 20%;' if (v < 0.3) and (v > -0.3) else None)\n\ndef highlight_max(s, props=''):\n return np.where(s == np.nanmax(s.values), props, '')\n\n# darkblue, pink\ns2.apply(highlight_max, props='color:white;background-color:#00008b', axis=0)\\\n.apply(highlight_max, props='color:white;background-color: #ffc0cb;', axis=1)\\\n.apply(highlight_max, props='color:white;background-color:purple', axis=None)\n```\n\n::: {.cell-output .cell-output-display execution_count=3}\n```{=html}\n<style type=\"text/css\">\n#T_4ffe1_row0_col2, #T_4ffe1_row7_col1 {\n color: white;\n background-color: #00008b;\n}\n#T_4ffe1_row0_col3 {\n color: white;\n background-color: #00008b;\n color: white;\n background-color: #ffc0cb;\n}\n#T_4ffe1_row1_col0, #T_4ffe1_row2_col3, #T_4ffe1_row3_col0, #T_4ffe1_row4_col0, #T_4ffe1_row5_col2, #T_4ffe1_row7_col0, #T_4ffe1_row9_col0 {\n color: white;\n background-color: #ffc0cb;\n}\n#T_4ffe1_row1_col1, #T_4ffe1_row4_col3, #T_4ffe1_row5_col0, #T_4ffe1_row5_col3, #T_4ffe1_row6_col1, #T_4ffe1_row8_col0, #T_4ffe1_row8_col1, #T_4ffe1_row8_col2, #T_4ffe1_row9_col2, #T_4ffe1_row9_col3 {\n color: red;\n}\n#T_4ffe1_row1_col3, #T_4ffe1_row2_col0, #T_4ffe1_row4_col1, #T_4ffe1_row6_col3 {\n color: red;\n opacity: 20%;\n}\n#T_4ffe1_row2_col2, #T_4ffe1_row3_col1, #T_4ffe1_row6_col2, #T_4ffe1_row7_col2 {\n opacity: 20%;\n}\n#T_4ffe1_row6_col0 {\n color: white;\n background-color: #00008b;\n color: white;\n background-color: #ffc0cb;\n color: white;\n background-color: purple;\n}\n#T_4ffe1_row8_col3 {\n opacity: 20%;\n color: white;\n background-color: #ffc0cb;\n}\n</style>\n<table id=\"T_4ffe1\">\n <thead>\n <tr>\n <th class=\"blank level0\" >&nbsp;</th>\n <th id=\"T_4ffe1_level0_col0\" class=\"col_heading level0 col0\" >A</th>\n <th id=\"T_4ffe1_level0_col1\" class=\"col_heading level0 col1\" >B</th>\n <th id=\"T_4ffe1_level0_col2\" class=\"col_heading level0 col2\" >C</th>\n <th id=\"T_4ffe1_level0_col3\" class=\"col_heading level0 col3\" >D</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th id=\"T_4ffe1_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n <td id=\"T_4ffe1_row0_col0\" class=\"data row0 col0\" >1.764052</td>\n <td id=\"T_4ffe1_row0_col1\" class=\"data row0 col1\" >0.400157</td>\n <td id=\"T_4ffe1_row0_col2\" class=\"data row0 col2\" >0.978738</td>\n <td id=\"T_4ffe1_row0_col3\" class=\"data row0 col3\" >2.240893</td>\n </tr>\n <tr>\n <th id=\"T_4ffe1_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n <td id=\"T_4ffe1_row1_col0\" class=\"data row1 col0\" >1.867558</td>\n <td id=\"T_4ffe1_row1_col1\" class=\"data row1 col1\" >-0.977278</td>\n <td id=\"T_4ffe1_row1_col2\" class=\"data row1 col2\" >0.950088</td>\n <td id=\"T_4ffe1_row1_col3\" class=\"data row1 col3\" >-0.151357</td>\n </tr>\n <tr>\n <th id=\"T_4ffe1_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n <td id=\"T_4ffe1_row2_col0\" class=\"data row2 col0\" >-0.103219</td>\n <td id=\"T_4ffe1_row2_col1\" class=\"data row2 col1\" >0.410599</td>\n <td id=\"T_4ffe1_row2_col2\" class=\"data row2 col2\" >0.144044</td>\n <td id=\"T_4ffe1_row2_col3\" class=\"data row2 col3\" >1.454274</td>\n </tr>\n <tr>\n <th id=\"T_4ffe1_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n <td id=\"T_4ffe1_row3_col0\" class=\"data row3 col0\" >0.761038</td>\n <td id=\"T_4ffe1_row3_col1\" class=\"data row3 col1\" >0.121675</td>\n <td id=\"T_4ffe1_row3_col2\" class=\"data row3 col2\" >0.443863</td>\n <td id=\"T_4ffe1_row3_col3\" class=\"data row3 col3\" >0.333674</td>\n </tr>\n <tr>\n <th id=\"T_4ffe1_level0_row4\" class=\"row_heading level0 row4\" >4</th>\n <td id=\"T_4ffe1_row4_col0\" class=\"data row4 col0\" >1.494079</td>\n <td id=\"T_4ffe1_row4_col1\" class=\"data row4 col1\" >-0.205158</td>\n <td id=\"T_4ffe1_row4_col2\" class=\"data row4 col2\" >0.313068</td>\n <td id=\"T_4ffe1_row4_col3\" class=\"data row4 col3\" >-0.854096</td>\n </tr>\n <tr>\n <th id=\"T_4ffe1_level0_row5\" class=\"row_heading level0 row5\" >5</th>\n <td id=\"T_4ffe1_row5_col0\" class=\"data row5 col0\" >-2.552990</td>\n <td id=\"T_4ffe1_row5_col1\" class=\"data row5 col1\" >0.653619</td>\n <td id=\"T_4ffe1_row5_col2\" class=\"data row5 col2\" >0.864436</td>\n <td id=\"T_4ffe1_row5_col3\" class=\"data row5 col3\" >-0.742165</td>\n </tr>\n <tr>\n <th id=\"T_4ffe1_level0_row6\" class=\"row_heading level0 row6\" >6</th>\n <td id=\"T_4ffe1_row6_col0\" class=\"data row6 col0\" >2.269755</td>\n <td id=\"T_4ffe1_row6_col1\" class=\"data row6 col1\" >-1.454366</td>\n <td id=\"T_4ffe1_row6_col2\" class=\"data row6 col2\" >0.045759</td>\n <td id=\"T_4ffe1_row6_col3\" class=\"data row6 col3\" >-0.187184</td>\n </tr>\n <tr>\n <th id=\"T_4ffe1_level0_row7\" class=\"row_heading level0 row7\" >7</th>\n <td id=\"T_4ffe1_row7_col0\" class=\"data row7 col0\" >1.532779</td>\n <td id=\"T_4ffe1_row7_col1\" class=\"data row7 col1\" >1.469359</td>\n <td id=\"T_4ffe1_row7_col2\" class=\"data row7 col2\" >0.154947</td>\n <td id=\"T_4ffe1_row7_col3\" class=\"data row7 col3\" >0.378163</td>\n </tr>\n <tr>\n <th id=\"T_4ffe1_level0_row8\" class=\"row_heading level0 row8\" >8</th>\n <td id=\"T_4ffe1_row8_col0\" class=\"data row8 col0\" >-0.887786</td>\n <td id=\"T_4ffe1_row8_col1\" class=\"data row8 col1\" >-1.980796</td>\n <td id=\"T_4ffe1_row8_col2\" class=\"data row8 col2\" >-0.347912</td>\n <td id=\"T_4ffe1_row8_col3\" class=\"data row8 col3\" >0.156349</td>\n </tr>\n <tr>\n <th id=\"T_4ffe1_level0_row9\" class=\"row_heading level0 row9\" >9</th>\n <td id=\"T_4ffe1_row9_col0\" class=\"data row9 col0\" >1.230291</td>\n <td id=\"T_4ffe1_row9_col1\" class=\"data row9 col1\" >1.202380</td>\n <td id=\"T_4ffe1_row9_col2\" class=\"data row9 col2\" >-0.387327</td>\n <td id=\"T_4ffe1_row9_col3\" class=\"data row9 col3\" >-0.302303</td>\n </tr>\n </tbody>\n</table>\n```\n:::\n:::\n\n\n",
"markdown": "---\ntitle: \"Pandas - Acting on Data\"\nformat: \n typst: default\n html:\n format-links: false\n theme: default\nbibliography: []\nreferences:\n - type: website\n id: pandas-user-guide\n url: https://pandas.pydata.org/pandas-docs/version/2.2.2/user_guide/style.html#Acting-on-the-Index-and-Column-Headers\n---\n\n```{=typst}\n#set page(numbering: none)\n```\n\n::: {#e0ca7130 .cell .plain execution_count=1}\n``` {.python .cell-code}\nimport pandas as pd\nimport numpy as np\n\nnp.random.seed(0)\ndf2 = pd.DataFrame(np.random.randn(10,4), columns=['A','B','C','D'])\n\ndef style_negative(v, props=''):\n return props if v < 0 else None\ns2 = df2.style.map(style_negative, props='color:red;')\\\n .map(lambda v: 'opacity: 20%;' if (v < 0.3) and (v > -0.3) else None)\n\ndef highlight_max(s, props=''):\n return np.where(s == np.nanmax(s.values), props, '')\n\n# darkblue, pink\ns2.apply(highlight_max, props='color:white;background-color:#00008b', axis=0)\\\n.apply(highlight_max, props='color:white;background-color: #ffc0cb;', axis=1)\\\n.apply(highlight_max, props='color:white;background-color:purple', axis=None)\n```\n\n::: {.cell-output .cell-output-display execution_count=3}\n```{=html}\n<style type=\"text/css\">\n#T_7f353_row0_col2, #T_7f353_row7_col1 {\n color: white;\n background-color: #00008b;\n}\n#T_7f353_row0_col3 {\n color: white;\n background-color: #00008b;\n color: white;\n background-color: #ffc0cb;\n}\n#T_7f353_row1_col0, #T_7f353_row2_col3, #T_7f353_row3_col0, #T_7f353_row4_col0, #T_7f353_row5_col2, #T_7f353_row7_col0, #T_7f353_row9_col0 {\n color: white;\n background-color: #ffc0cb;\n}\n#T_7f353_row1_col1, #T_7f353_row4_col3, #T_7f353_row5_col0, #T_7f353_row5_col3, #T_7f353_row6_col1, #T_7f353_row8_col0, #T_7f353_row8_col1, #T_7f353_row8_col2, #T_7f353_row9_col2, #T_7f353_row9_col3 {\n color: red;\n}\n#T_7f353_row1_col3, #T_7f353_row2_col0, #T_7f353_row4_col1, #T_7f353_row6_col3 {\n color: red;\n opacity: 20%;\n}\n#T_7f353_row2_col2, #T_7f353_row3_col1, #T_7f353_row6_col2, #T_7f353_row7_col2 {\n opacity: 20%;\n}\n#T_7f353_row6_col0 {\n color: white;\n background-color: #00008b;\n color: white;\n background-color: #ffc0cb;\n color: white;\n background-color: purple;\n}\n#T_7f353_row8_col3 {\n opacity: 20%;\n color: white;\n background-color: #ffc0cb;\n}\n</style>\n<table id=\"T_7f353\">\n <thead>\n <tr>\n <th class=\"blank level0\" >&nbsp;</th>\n <th id=\"T_7f353_level0_col0\" class=\"col_heading level0 col0\" >A</th>\n <th id=\"T_7f353_level0_col1\" class=\"col_heading level0 col1\" >B</th>\n <th id=\"T_7f353_level0_col2\" class=\"col_heading level0 col2\" >C</th>\n <th id=\"T_7f353_level0_col3\" class=\"col_heading level0 col3\" >D</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th id=\"T_7f353_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n <td id=\"T_7f353_row0_col0\" class=\"data row0 col0\" >1.764052</td>\n <td id=\"T_7f353_row0_col1\" class=\"data row0 col1\" >0.400157</td>\n <td id=\"T_7f353_row0_col2\" class=\"data row0 col2\" >0.978738</td>\n <td id=\"T_7f353_row0_col3\" class=\"data row0 col3\" >2.240893</td>\n </tr>\n <tr>\n <th id=\"T_7f353_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n <td id=\"T_7f353_row1_col0\" class=\"data row1 col0\" >1.867558</td>\n <td id=\"T_7f353_row1_col1\" class=\"data row1 col1\" >-0.977278</td>\n <td id=\"T_7f353_row1_col2\" class=\"data row1 col2\" >0.950088</td>\n <td id=\"T_7f353_row1_col3\" class=\"data row1 col3\" >-0.151357</td>\n </tr>\n <tr>\n <th id=\"T_7f353_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n <td id=\"T_7f353_row2_col0\" class=\"data row2 col0\" >-0.103219</td>\n <td id=\"T_7f353_row2_col1\" class=\"data row2 col1\" >0.410599</td>\n <td id=\"T_7f353_row2_col2\" class=\"data row2 col2\" >0.144044</td>\n <td id=\"T_7f353_row2_col3\" class=\"data row2 col3\" >1.454274</td>\n </tr>\n <tr>\n <th id=\"T_7f353_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n <td id=\"T_7f353_row3_col0\" class=\"data row3 col0\" >0.761038</td>\n <td id=\"T_7f353_row3_col1\" class=\"data row3 col1\" >0.121675</td>\n <td id=\"T_7f353_row3_col2\" class=\"data row3 col2\" >0.443863</td>\n <td id=\"T_7f353_row3_col3\" class=\"data row3 col3\" >0.333674</td>\n </tr>\n <tr>\n <th id=\"T_7f353_level0_row4\" class=\"row_heading level0 row4\" >4</th>\n <td id=\"T_7f353_row4_col0\" class=\"data row4 col0\" >1.494079</td>\n <td id=\"T_7f353_row4_col1\" class=\"data row4 col1\" >-0.205158</td>\n <td id=\"T_7f353_row4_col2\" class=\"data row4 col2\" >0.313068</td>\n <td id=\"T_7f353_row4_col3\" class=\"data row4 col3\" >-0.854096</td>\n </tr>\n <tr>\n <th id=\"T_7f353_level0_row5\" class=\"row_heading level0 row5\" >5</th>\n <td id=\"T_7f353_row5_col0\" class=\"data row5 col0\" >-2.552990</td>\n <td id=\"T_7f353_row5_col1\" class=\"data row5 col1\" >0.653619</td>\n <td id=\"T_7f353_row5_col2\" class=\"data row5 col2\" >0.864436</td>\n <td id=\"T_7f353_row5_col3\" class=\"data row5 col3\" >-0.742165</td>\n </tr>\n <tr>\n <th id=\"T_7f353_level0_row6\" class=\"row_heading level0 row6\" >6</th>\n <td id=\"T_7f353_row6_col0\" class=\"data row6 col0\" >2.269755</td>\n <td id=\"T_7f353_row6_col1\" class=\"data row6 col1\" >-1.454366</td>\n <td id=\"T_7f353_row6_col2\" class=\"data row6 col2\" >0.045759</td>\n <td id=\"T_7f353_row6_col3\" class=\"data row6 col3\" >-0.187184</td>\n </tr>\n <tr>\n <th id=\"T_7f353_level0_row7\" class=\"row_heading level0 row7\" >7</th>\n <td id=\"T_7f353_row7_col0\" class=\"data row7 col0\" >1.532779</td>\n <td id=\"T_7f353_row7_col1\" class=\"data row7 col1\" >1.469359</td>\n <td id=\"T_7f353_row7_col2\" class=\"data row7 col2\" >0.154947</td>\n <td id=\"T_7f353_row7_col3\" class=\"data row7 col3\" >0.378163</td>\n </tr>\n <tr>\n <th id=\"T_7f353_level0_row8\" class=\"row_heading level0 row8\" >8</th>\n <td id=\"T_7f353_row8_col0\" class=\"data row8 col0\" >-0.887786</td>\n <td id=\"T_7f353_row8_col1\" class=\"data row8 col1\" >-1.980796</td>\n <td id=\"T_7f353_row8_col2\" class=\"data row8 col2\" >-0.347912</td>\n <td id=\"T_7f353_row8_col3\" class=\"data row8 col3\" >0.156349</td>\n </tr>\n <tr>\n <th id=\"T_7f353_level0_row9\" class=\"row_heading level0 row9\" >9</th>\n <td id=\"T_7f353_row9_col0\" class=\"data row9 col0\" >1.230291</td>\n <td id=\"T_7f353_row9_col1\" class=\"data row9 col1\" >1.202380</td>\n <td id=\"T_7f353_row9_col2\" class=\"data row9 col2\" >-0.387327</td>\n <td id=\"T_7f353_row9_col3\" class=\"data row9 col3\" >-0.302303</td>\n </tr>\n </tbody>\n</table>\n```\n:::\n:::\n\n\n",
"supporting": [
"pandas-acting-on-data_files/figure-html"
],
Expand Down
Loading

0 comments on commit dcfe856

Please sign in to comment.