Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ericdatakelly/ea207d3b729b88a950294f094ed19632 to your computer and use it in GitHub Desktop.
Save ericdatakelly/ea207d3b729b88a950294f094ed19632 to your computer and use it in GitHub Desktop.
learning about dataframes using color
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"id": "e8fca6ab-6a9c-473a-89cf-1de6a1a7c76e",
"metadata": {},
"source": [
"# what do we learn when we _make colormaps from dataframes_",
"<!-- TEASER_END -->"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "391cab50-209e-4843-8bea-0405f6734e6f",
"metadata": {},
"outputs": [],
"source": [
" import pandas, numpy, toolz.curried as toolz"
]
},
{
"cell_type": "markdown",
"id": "a70b7740-2403-4f93-be3f-cd8f2d130dc1",
"metadata": {},
"source": [
"we'll begin with a small linear `domain` of values between 0..1."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "3051c7a7-3146-4133-8bc2-fc39eb86a44c",
"metadata": {},
"outputs": [],
"source": [
" domain = numpy.linspace(0, 1, 11)"
]
},
{
"cell_type": "markdown",
"id": "d41e586d-5718-4a90-afd0-b51f72aa5ed8",
"metadata": {},
"source": [
"we'll focus on primary color components to start. from the primary components we can make a lot of colors. we combine the `domain` with empty values, to create triplets that will become our color."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "edc02b2e-0c38-416d-a740-8ee24e5ce8d9",
"metadata": {},
"outputs": [],
"source": [
" triples = list(map(numpy.array, zip(domain, domain*0, domain*0)))"
]
},
{
"cell_type": "markdown",
"id": "aed34348-68c1-4b6f-8e42-6c0823c24cbc",
"metadata": {},
"source": [
"we'll start with making `red`, with a focus on `rgb` values, as a series of triples between 0..255."
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "f49ed88c-0de5-4bd3-b061-c2836d77a758",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 [0.0, 0.0, 0.0]\n",
"1 [25.5, 0.0, 0.0]\n",
"2 [51.0, 0.0, 0.0]\n",
"3 [76.50000000000001, 0.0, 0.0]\n",
"4 [102.0, 0.0, 0.0]\n",
"5 [127.5, 0.0, 0.0]\n",
"6 [153.00000000000003, 0.0, 0.0]\n",
"7 [178.50000000000003, 0.0, 0.0]\n",
"8 [204.0, 0.0, 0.0]\n",
"9 [229.5, 0.0, 0.0]\n",
"10 [255.0, 0.0, 0.0]\n",
"dtype: object"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
" red = pandas.Series(triples).apply(numpy.array).mul(255)\n",
" red"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "217768d9-1ce7-496d-8742-44e0e91d3fb0",
"metadata": {},
"outputs": [],
"source": [
" def rgb(x): \"format a pandas cells\"; return \"font-size: 0px; background-color: rgb(\" + \", \".join(\n",
" map(str, x)\n",
" ) + \");\""
]
},
{
"cell_type": "markdown",
"id": "5d34608c-8156-4d22-be44-ba609a0abd5b",
"metadata": {},
"source": [
"why are we calling this value `red`?\n",
"\n",
"because we can explicitly the format for each cell and (255, 0, 0) is completely red."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "46b16014-84a3-4138-b920-b7c625bb0a79",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>0</th>\n",
" <th>1</th>\n",
" <th>2</th>\n",
" <th>3</th>\n",
" <th>4</th>\n",
" <th>5</th>\n",
" <th>6</th>\n",
" <th>7</th>\n",
" <th>8</th>\n",
" <th>9</th>\n",
" <th>10</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>red</th>\n",
" <td>font-size: 0px; background-color: rgb(0.0, 0.0...</td>\n",
" <td>font-size: 0px; background-color: rgb(25.5, 0....</td>\n",
" <td>font-size: 0px; background-color: rgb(51.0, 0....</td>\n",
" <td>font-size: 0px; background-color: rgb(76.50000...</td>\n",
" <td>font-size: 0px; background-color: rgb(102.0, 0...</td>\n",
" <td>font-size: 0px; background-color: rgb(127.5, 0...</td>\n",
" <td>font-size: 0px; background-color: rgb(153.0000...</td>\n",
" <td>font-size: 0px; background-color: rgb(178.5000...</td>\n",
" <td>font-size: 0px; background-color: rgb(204.0, 0...</td>\n",
" <td>font-size: 0px; background-color: rgb(229.5, 0...</td>\n",
" <td>font-size: 0px; background-color: rgb(255.0, 0...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 0 \\\n",
"red font-size: 0px; background-color: rgb(0.0, 0.0... \n",
"\n",
" 1 \\\n",
"red font-size: 0px; background-color: rgb(25.5, 0.... \n",
"\n",
" 2 \\\n",
"red font-size: 0px; background-color: rgb(51.0, 0.... \n",
"\n",
" 3 \\\n",
"red font-size: 0px; background-color: rgb(76.50000... \n",
"\n",
" 4 \\\n",
"red font-size: 0px; background-color: rgb(102.0, 0... \n",
"\n",
" 5 \\\n",
"red font-size: 0px; background-color: rgb(127.5, 0... \n",
"\n",
" 6 \\\n",
"red font-size: 0px; background-color: rgb(153.0000... \n",
"\n",
" 7 \\\n",
"red font-size: 0px; background-color: rgb(178.5000... \n",
"\n",
" 8 \\\n",
"red font-size: 0px; background-color: rgb(204.0, 0... \n",
"\n",
" 9 \\\n",
"red font-size: 0px; background-color: rgb(229.5, 0... \n",
"\n",
" 10 \n",
"red font-size: 0px; background-color: rgb(255.0, 0... "
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
" red.to_frame(\"red\").T.applymap(rgb)"
]
},
{
"cell_type": "markdown",
"id": "cbbffae6-f611-47a4-8446-4b3fd94ac318",
"metadata": {},
"source": [
"with a small change to code in the cell above, we can indeed colorize our table."
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "479d0f2c-2268-4628-aadb-d78ccef280ff",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style type=\"text/css\">\n",
"#T_28aad_row0_col0 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 0.0);\n",
"}\n",
"#T_28aad_row0_col1 {\n",
" font-size: 0px;\n",
" background-color: rgb(25.5, 0.0, 0.0);\n",
"}\n",
"#T_28aad_row0_col2 {\n",
" font-size: 0px;\n",
" background-color: rgb(51.0, 0.0, 0.0);\n",
"}\n",
"#T_28aad_row0_col3 {\n",
" font-size: 0px;\n",
" background-color: rgb(76.50000000000001, 0.0, 0.0);\n",
"}\n",
"#T_28aad_row0_col4 {\n",
" font-size: 0px;\n",
" background-color: rgb(102.0, 0.0, 0.0);\n",
"}\n",
"#T_28aad_row0_col5 {\n",
" font-size: 0px;\n",
" background-color: rgb(127.5, 0.0, 0.0);\n",
"}\n",
"#T_28aad_row0_col6 {\n",
" font-size: 0px;\n",
" background-color: rgb(153.00000000000003, 0.0, 0.0);\n",
"}\n",
"#T_28aad_row0_col7 {\n",
" font-size: 0px;\n",
" background-color: rgb(178.50000000000003, 0.0, 0.0);\n",
"}\n",
"#T_28aad_row0_col8 {\n",
" font-size: 0px;\n",
" background-color: rgb(204.0, 0.0, 0.0);\n",
"}\n",
"#T_28aad_row0_col9 {\n",
" font-size: 0px;\n",
" background-color: rgb(229.5, 0.0, 0.0);\n",
"}\n",
"#T_28aad_row0_col10 {\n",
" font-size: 0px;\n",
" background-color: rgb(255.0, 0.0, 0.0);\n",
"}\n",
"</style>\n",
"<table id=\"T_28aad_\">\n",
" <thead>\n",
" <tr>\n",
" <th class=\"blank level0\" >&nbsp;</th>\n",
" <th class=\"col_heading level0 col0\" >0</th>\n",
" <th class=\"col_heading level0 col1\" >1</th>\n",
" <th class=\"col_heading level0 col2\" >2</th>\n",
" <th class=\"col_heading level0 col3\" >3</th>\n",
" <th class=\"col_heading level0 col4\" >4</th>\n",
" <th class=\"col_heading level0 col5\" >5</th>\n",
" <th class=\"col_heading level0 col6\" >6</th>\n",
" <th class=\"col_heading level0 col7\" >7</th>\n",
" <th class=\"col_heading level0 col8\" >8</th>\n",
" <th class=\"col_heading level0 col9\" >9</th>\n",
" <th class=\"col_heading level0 col10\" >10</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th id=\"T_28aad_level0_row0\" class=\"row_heading level0 row0\" >red</th>\n",
" <td id=\"T_28aad_row0_col0\" class=\"data row0 col0\" >[0. 0. 0.]</td>\n",
" <td id=\"T_28aad_row0_col1\" class=\"data row0 col1\" >[25.5 0. 0. ]</td>\n",
" <td id=\"T_28aad_row0_col2\" class=\"data row0 col2\" >[51. 0. 0.]</td>\n",
" <td id=\"T_28aad_row0_col3\" class=\"data row0 col3\" >[76.5 0. 0. ]</td>\n",
" <td id=\"T_28aad_row0_col4\" class=\"data row0 col4\" >[102. 0. 0.]</td>\n",
" <td id=\"T_28aad_row0_col5\" class=\"data row0 col5\" >[127.5 0. 0. ]</td>\n",
" <td id=\"T_28aad_row0_col6\" class=\"data row0 col6\" >[153. 0. 0.]</td>\n",
" <td id=\"T_28aad_row0_col7\" class=\"data row0 col7\" >[178.5 0. 0. ]</td>\n",
" <td id=\"T_28aad_row0_col8\" class=\"data row0 col8\" >[204. 0. 0.]</td>\n",
" <td id=\"T_28aad_row0_col9\" class=\"data row0 col9\" >[229.5 0. 0. ]</td>\n",
" <td id=\"T_28aad_row0_col10\" class=\"data row0 col10\" >[255. 0. 0.]</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n"
],
"text/plain": [
"<pandas.io.formats.style.Styler at 0x7efb941569a0>"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
" red.to_frame(\"red\").T.style.applymap(rgb)"
]
},
{
"cell_type": "markdown",
"id": "60a9685e-5747-45d0-a034-44d75990f898",
"metadata": {},
"source": [
"green and blue are a `shift` of the indices in the triple."
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "5dcb579d-2ccd-4cf2-895d-9ca1d7601816",
"metadata": {},
"outputs": [],
"source": [
" @toolz.curry\n",
" def shift(n, x):\n",
" return numpy.concatenate([x[n:], x[:n]])"
]
},
{
"cell_type": "markdown",
"id": "e68b6b66-0d42-4075-aad0-a5e99c439c76",
"metadata": {},
"source": [
"with `shift(1)` for blue, and `shift(2)` for green we can construct a composite dataframe with all of our `rgb` colorvalues `...`"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "31d0767a-87cb-400d-9e2d-60d9724a76d6",
"metadata": {},
"outputs": [],
"source": [
" colors = \"red blue green\".split()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "41557bbf-ce57-4f5e-a7a6-b0e4e1b1c1ab",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>0</th>\n",
" <th>1</th>\n",
" <th>2</th>\n",
" <th>3</th>\n",
" <th>4</th>\n",
" <th>5</th>\n",
" <th>6</th>\n",
" <th>7</th>\n",
" <th>8</th>\n",
" <th>9</th>\n",
" <th>10</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>red</th>\n",
" <td>[0.0, 0.0, 0.0]</td>\n",
" <td>[25.5, 0.0, 0.0]</td>\n",
" <td>[51.0, 0.0, 0.0]</td>\n",
" <td>[76.50000000000001, 0.0, 0.0]</td>\n",
" <td>[102.0, 0.0, 0.0]</td>\n",
" <td>[127.5, 0.0, 0.0]</td>\n",
" <td>[153.00000000000003, 0.0, 0.0]</td>\n",
" <td>[178.50000000000003, 0.0, 0.0]</td>\n",
" <td>[204.0, 0.0, 0.0]</td>\n",
" <td>[229.5, 0.0, 0.0]</td>\n",
" <td>[255.0, 0.0, 0.0]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>blue</th>\n",
" <td>[0.0, 0.0, 0.0]</td>\n",
" <td>[0.0, 0.0, 25.5]</td>\n",
" <td>[0.0, 0.0, 51.0]</td>\n",
" <td>[0.0, 0.0, 76.50000000000001]</td>\n",
" <td>[0.0, 0.0, 102.0]</td>\n",
" <td>[0.0, 0.0, 127.5]</td>\n",
" <td>[0.0, 0.0, 153.00000000000003]</td>\n",
" <td>[0.0, 0.0, 178.50000000000003]</td>\n",
" <td>[0.0, 0.0, 204.0]</td>\n",
" <td>[0.0, 0.0, 229.5]</td>\n",
" <td>[0.0, 0.0, 255.0]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>green</th>\n",
" <td>[0.0, 0.0, 0.0]</td>\n",
" <td>[0.0, 25.5, 0.0]</td>\n",
" <td>[0.0, 51.0, 0.0]</td>\n",
" <td>[0.0, 76.50000000000001, 0.0]</td>\n",
" <td>[0.0, 102.0, 0.0]</td>\n",
" <td>[0.0, 127.5, 0.0]</td>\n",
" <td>[0.0, 153.00000000000003, 0.0]</td>\n",
" <td>[0.0, 178.50000000000003, 0.0]</td>\n",
" <td>[0.0, 204.0, 0.0]</td>\n",
" <td>[0.0, 229.5, 0.0]</td>\n",
" <td>[0.0, 255.0, 0.0]</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 0 1 2 \\\n",
"red [0.0, 0.0, 0.0] [25.5, 0.0, 0.0] [51.0, 0.0, 0.0] \n",
"blue [0.0, 0.0, 0.0] [0.0, 0.0, 25.5] [0.0, 0.0, 51.0] \n",
"green [0.0, 0.0, 0.0] [0.0, 25.5, 0.0] [0.0, 51.0, 0.0] \n",
"\n",
" 3 4 5 \\\n",
"red [76.50000000000001, 0.0, 0.0] [102.0, 0.0, 0.0] [127.5, 0.0, 0.0] \n",
"blue [0.0, 0.0, 76.50000000000001] [0.0, 0.0, 102.0] [0.0, 0.0, 127.5] \n",
"green [0.0, 76.50000000000001, 0.0] [0.0, 102.0, 0.0] [0.0, 127.5, 0.0] \n",
"\n",
" 6 7 \\\n",
"red [153.00000000000003, 0.0, 0.0] [178.50000000000003, 0.0, 0.0] \n",
"blue [0.0, 0.0, 153.00000000000003] [0.0, 0.0, 178.50000000000003] \n",
"green [0.0, 153.00000000000003, 0.0] [0.0, 178.50000000000003, 0.0] \n",
"\n",
" 8 9 10 \n",
"red [204.0, 0.0, 0.0] [229.5, 0.0, 0.0] [255.0, 0.0, 0.0] \n",
"blue [0.0, 0.0, 204.0] [0.0, 0.0, 229.5] [0.0, 0.0, 255.0] \n",
"green [0.0, 204.0, 0.0] [0.0, 229.5, 0.0] [0.0, 255.0, 0.0] "
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
" df = pandas.concat({\n",
" c: red.apply(shift(i)).rename(c) for i, c in enumerate(colors)\n",
" }, axis=1).T; df"
]
},
{
"cell_type": "markdown",
"id": "f3453a0e-2411-450c-951f-7741192ee14f",
"metadata": {},
"source": [
"that may be stylized using the `df.style` feature"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "7853ec2c-2131-42c4-ade7-187370d1dfd5",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style type=\"text/css\">\n",
"#T_dd8aa_row0_col0, #T_dd8aa_row1_col0, #T_dd8aa_row2_col0 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 0.0);\n",
"}\n",
"#T_dd8aa_row0_col1 {\n",
" font-size: 0px;\n",
" background-color: rgb(25.5, 0.0, 0.0);\n",
"}\n",
"#T_dd8aa_row0_col2 {\n",
" font-size: 0px;\n",
" background-color: rgb(51.0, 0.0, 0.0);\n",
"}\n",
"#T_dd8aa_row0_col3 {\n",
" font-size: 0px;\n",
" background-color: rgb(76.50000000000001, 0.0, 0.0);\n",
"}\n",
"#T_dd8aa_row0_col4 {\n",
" font-size: 0px;\n",
" background-color: rgb(102.0, 0.0, 0.0);\n",
"}\n",
"#T_dd8aa_row0_col5 {\n",
" font-size: 0px;\n",
" background-color: rgb(127.5, 0.0, 0.0);\n",
"}\n",
"#T_dd8aa_row0_col6 {\n",
" font-size: 0px;\n",
" background-color: rgb(153.00000000000003, 0.0, 0.0);\n",
"}\n",
"#T_dd8aa_row0_col7 {\n",
" font-size: 0px;\n",
" background-color: rgb(178.50000000000003, 0.0, 0.0);\n",
"}\n",
"#T_dd8aa_row0_col8 {\n",
" font-size: 0px;\n",
" background-color: rgb(204.0, 0.0, 0.0);\n",
"}\n",
"#T_dd8aa_row0_col9 {\n",
" font-size: 0px;\n",
" background-color: rgb(229.5, 0.0, 0.0);\n",
"}\n",
"#T_dd8aa_row0_col10 {\n",
" font-size: 0px;\n",
" background-color: rgb(255.0, 0.0, 0.0);\n",
"}\n",
"#T_dd8aa_row1_col1 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 25.5);\n",
"}\n",
"#T_dd8aa_row1_col2 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 51.0);\n",
"}\n",
"#T_dd8aa_row1_col3 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 76.50000000000001);\n",
"}\n",
"#T_dd8aa_row1_col4 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 102.0);\n",
"}\n",
"#T_dd8aa_row1_col5 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 127.5);\n",
"}\n",
"#T_dd8aa_row1_col6 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 153.00000000000003);\n",
"}\n",
"#T_dd8aa_row1_col7 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 178.50000000000003);\n",
"}\n",
"#T_dd8aa_row1_col8 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 204.0);\n",
"}\n",
"#T_dd8aa_row1_col9 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 229.5);\n",
"}\n",
"#T_dd8aa_row1_col10 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 255.0);\n",
"}\n",
"#T_dd8aa_row2_col1 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 25.5, 0.0);\n",
"}\n",
"#T_dd8aa_row2_col2 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 51.0, 0.0);\n",
"}\n",
"#T_dd8aa_row2_col3 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 76.50000000000001, 0.0);\n",
"}\n",
"#T_dd8aa_row2_col4 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 102.0, 0.0);\n",
"}\n",
"#T_dd8aa_row2_col5 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 127.5, 0.0);\n",
"}\n",
"#T_dd8aa_row2_col6 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 153.00000000000003, 0.0);\n",
"}\n",
"#T_dd8aa_row2_col7 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 178.50000000000003, 0.0);\n",
"}\n",
"#T_dd8aa_row2_col8 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 204.0, 0.0);\n",
"}\n",
"#T_dd8aa_row2_col9 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 229.5, 0.0);\n",
"}\n",
"#T_dd8aa_row2_col10 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 255.0, 0.0);\n",
"}\n",
"</style>\n",
"<table id=\"T_dd8aa_\">\n",
" <thead>\n",
" <tr>\n",
" <th class=\"blank level0\" >&nbsp;</th>\n",
" <th class=\"col_heading level0 col0\" >0</th>\n",
" <th class=\"col_heading level0 col1\" >1</th>\n",
" <th class=\"col_heading level0 col2\" >2</th>\n",
" <th class=\"col_heading level0 col3\" >3</th>\n",
" <th class=\"col_heading level0 col4\" >4</th>\n",
" <th class=\"col_heading level0 col5\" >5</th>\n",
" <th class=\"col_heading level0 col6\" >6</th>\n",
" <th class=\"col_heading level0 col7\" >7</th>\n",
" <th class=\"col_heading level0 col8\" >8</th>\n",
" <th class=\"col_heading level0 col9\" >9</th>\n",
" <th class=\"col_heading level0 col10\" >10</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th id=\"T_dd8aa_level0_row0\" class=\"row_heading level0 row0\" >red</th>\n",
" <td id=\"T_dd8aa_row0_col0\" class=\"data row0 col0\" >[0. 0. 0.]</td>\n",
" <td id=\"T_dd8aa_row0_col1\" class=\"data row0 col1\" >[25.5 0. 0. ]</td>\n",
" <td id=\"T_dd8aa_row0_col2\" class=\"data row0 col2\" >[51. 0. 0.]</td>\n",
" <td id=\"T_dd8aa_row0_col3\" class=\"data row0 col3\" >[76.5 0. 0. ]</td>\n",
" <td id=\"T_dd8aa_row0_col4\" class=\"data row0 col4\" >[102. 0. 0.]</td>\n",
" <td id=\"T_dd8aa_row0_col5\" class=\"data row0 col5\" >[127.5 0. 0. ]</td>\n",
" <td id=\"T_dd8aa_row0_col6\" class=\"data row0 col6\" >[153. 0. 0.]</td>\n",
" <td id=\"T_dd8aa_row0_col7\" class=\"data row0 col7\" >[178.5 0. 0. ]</td>\n",
" <td id=\"T_dd8aa_row0_col8\" class=\"data row0 col8\" >[204. 0. 0.]</td>\n",
" <td id=\"T_dd8aa_row0_col9\" class=\"data row0 col9\" >[229.5 0. 0. ]</td>\n",
" <td id=\"T_dd8aa_row0_col10\" class=\"data row0 col10\" >[255. 0. 0.]</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_dd8aa_level0_row1\" class=\"row_heading level0 row1\" >blue</th>\n",
" <td id=\"T_dd8aa_row1_col0\" class=\"data row1 col0\" >[0. 0. 0.]</td>\n",
" <td id=\"T_dd8aa_row1_col1\" class=\"data row1 col1\" >[ 0. 0. 25.5]</td>\n",
" <td id=\"T_dd8aa_row1_col2\" class=\"data row1 col2\" >[ 0. 0. 51.]</td>\n",
" <td id=\"T_dd8aa_row1_col3\" class=\"data row1 col3\" >[ 0. 0. 76.5]</td>\n",
" <td id=\"T_dd8aa_row1_col4\" class=\"data row1 col4\" >[ 0. 0. 102.]</td>\n",
" <td id=\"T_dd8aa_row1_col5\" class=\"data row1 col5\" >[ 0. 0. 127.5]</td>\n",
" <td id=\"T_dd8aa_row1_col6\" class=\"data row1 col6\" >[ 0. 0. 153.]</td>\n",
" <td id=\"T_dd8aa_row1_col7\" class=\"data row1 col7\" >[ 0. 0. 178.5]</td>\n",
" <td id=\"T_dd8aa_row1_col8\" class=\"data row1 col8\" >[ 0. 0. 204.]</td>\n",
" <td id=\"T_dd8aa_row1_col9\" class=\"data row1 col9\" >[ 0. 0. 229.5]</td>\n",
" <td id=\"T_dd8aa_row1_col10\" class=\"data row1 col10\" >[ 0. 0. 255.]</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_dd8aa_level0_row2\" class=\"row_heading level0 row2\" >green</th>\n",
" <td id=\"T_dd8aa_row2_col0\" class=\"data row2 col0\" >[0. 0. 0.]</td>\n",
" <td id=\"T_dd8aa_row2_col1\" class=\"data row2 col1\" >[ 0. 25.5 0. ]</td>\n",
" <td id=\"T_dd8aa_row2_col2\" class=\"data row2 col2\" >[ 0. 51. 0.]</td>\n",
" <td id=\"T_dd8aa_row2_col3\" class=\"data row2 col3\" >[ 0. 76.5 0. ]</td>\n",
" <td id=\"T_dd8aa_row2_col4\" class=\"data row2 col4\" >[ 0. 102. 0.]</td>\n",
" <td id=\"T_dd8aa_row2_col5\" class=\"data row2 col5\" >[ 0. 127.5 0. ]</td>\n",
" <td id=\"T_dd8aa_row2_col6\" class=\"data row2 col6\" >[ 0. 153. 0.]</td>\n",
" <td id=\"T_dd8aa_row2_col7\" class=\"data row2 col7\" >[ 0. 178.5 0. ]</td>\n",
" <td id=\"T_dd8aa_row2_col8\" class=\"data row2 col8\" >[ 0. 204. 0.]</td>\n",
" <td id=\"T_dd8aa_row2_col9\" class=\"data row2 col9\" >[ 0. 229.5 0. ]</td>\n",
" <td id=\"T_dd8aa_row2_col10\" class=\"data row2 col10\" >[ 0. 255. 0.]</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n"
],
"text/plain": [
"<pandas.io.formats.style.Styler at 0x7efb92ce5c70>"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
" df.style.applymap(rgb)"
]
},
{
"cell_type": "markdown",
"id": "87d38e4f-e311-4c97-b34b-837ec1a6392e",
"metadata": {},
"source": [
"from our `df` containing a primary palette we can build a `secondary` palette."
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "b938e547-da53-4d85-9594-f44a3d39aba1",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style type=\"text/css\">\n",
"#T_7fb02_row0_col0, #T_7fb02_row1_col0, #T_7fb02_row2_col0 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 0.0);\n",
"}\n",
"#T_7fb02_row0_col1 {\n",
" font-size: 0px;\n",
" background-color: rgb(25.5, 0.0, 25.5);\n",
"}\n",
"#T_7fb02_row0_col2 {\n",
" font-size: 0px;\n",
" background-color: rgb(51.0, 0.0, 51.0);\n",
"}\n",
"#T_7fb02_row0_col3 {\n",
" font-size: 0px;\n",
" background-color: rgb(76.50000000000001, 0.0, 76.50000000000001);\n",
"}\n",
"#T_7fb02_row0_col4 {\n",
" font-size: 0px;\n",
" background-color: rgb(102.0, 0.0, 102.0);\n",
"}\n",
"#T_7fb02_row0_col5 {\n",
" font-size: 0px;\n",
" background-color: rgb(127.5, 0.0, 127.5);\n",
"}\n",
"#T_7fb02_row0_col6 {\n",
" font-size: 0px;\n",
" background-color: rgb(153.00000000000003, 0.0, 153.00000000000003);\n",
"}\n",
"#T_7fb02_row0_col7 {\n",
" font-size: 0px;\n",
" background-color: rgb(178.50000000000003, 0.0, 178.50000000000003);\n",
"}\n",
"#T_7fb02_row0_col8 {\n",
" font-size: 0px;\n",
" background-color: rgb(204.0, 0.0, 204.0);\n",
"}\n",
"#T_7fb02_row0_col9 {\n",
" font-size: 0px;\n",
" background-color: rgb(229.5, 0.0, 229.5);\n",
"}\n",
"#T_7fb02_row0_col10 {\n",
" font-size: 0px;\n",
" background-color: rgb(255.0, 0.0, 255.0);\n",
"}\n",
"#T_7fb02_row1_col1 {\n",
" font-size: 0px;\n",
" background-color: rgb(25.5, 25.5, 0.0);\n",
"}\n",
"#T_7fb02_row1_col2 {\n",
" font-size: 0px;\n",
" background-color: rgb(51.0, 51.0, 0.0);\n",
"}\n",
"#T_7fb02_row1_col3 {\n",
" font-size: 0px;\n",
" background-color: rgb(76.50000000000001, 76.50000000000001, 0.0);\n",
"}\n",
"#T_7fb02_row1_col4 {\n",
" font-size: 0px;\n",
" background-color: rgb(102.0, 102.0, 0.0);\n",
"}\n",
"#T_7fb02_row1_col5 {\n",
" font-size: 0px;\n",
" background-color: rgb(127.5, 127.5, 0.0);\n",
"}\n",
"#T_7fb02_row1_col6 {\n",
" font-size: 0px;\n",
" background-color: rgb(153.00000000000003, 153.00000000000003, 0.0);\n",
"}\n",
"#T_7fb02_row1_col7 {\n",
" font-size: 0px;\n",
" background-color: rgb(178.50000000000003, 178.50000000000003, 0.0);\n",
"}\n",
"#T_7fb02_row1_col8 {\n",
" font-size: 0px;\n",
" background-color: rgb(204.0, 204.0, 0.0);\n",
"}\n",
"#T_7fb02_row1_col9 {\n",
" font-size: 0px;\n",
" background-color: rgb(229.5, 229.5, 0.0);\n",
"}\n",
"#T_7fb02_row1_col10 {\n",
" font-size: 0px;\n",
" background-color: rgb(255.0, 255.0, 0.0);\n",
"}\n",
"#T_7fb02_row2_col1 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 25.5, 25.5);\n",
"}\n",
"#T_7fb02_row2_col2 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 51.0, 51.0);\n",
"}\n",
"#T_7fb02_row2_col3 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 76.50000000000001, 76.50000000000001);\n",
"}\n",
"#T_7fb02_row2_col4 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 102.0, 102.0);\n",
"}\n",
"#T_7fb02_row2_col5 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 127.5, 127.5);\n",
"}\n",
"#T_7fb02_row2_col6 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 153.00000000000003, 153.00000000000003);\n",
"}\n",
"#T_7fb02_row2_col7 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 178.50000000000003, 178.50000000000003);\n",
"}\n",
"#T_7fb02_row2_col8 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 204.0, 204.0);\n",
"}\n",
"#T_7fb02_row2_col9 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 229.5, 229.5);\n",
"}\n",
"#T_7fb02_row2_col10 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 255.0, 255.0);\n",
"}\n",
"</style>\n",
"<table id=\"T_7fb02_\">\n",
" <thead>\n",
" <tr>\n",
" <th class=\"blank level0\" >&nbsp;</th>\n",
" <th class=\"col_heading level0 col0\" >0</th>\n",
" <th class=\"col_heading level0 col1\" >1</th>\n",
" <th class=\"col_heading level0 col2\" >2</th>\n",
" <th class=\"col_heading level0 col3\" >3</th>\n",
" <th class=\"col_heading level0 col4\" >4</th>\n",
" <th class=\"col_heading level0 col5\" >5</th>\n",
" <th class=\"col_heading level0 col6\" >6</th>\n",
" <th class=\"col_heading level0 col7\" >7</th>\n",
" <th class=\"col_heading level0 col8\" >8</th>\n",
" <th class=\"col_heading level0 col9\" >9</th>\n",
" <th class=\"col_heading level0 col10\" >10</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th id=\"T_7fb02_level0_row0\" class=\"row_heading level0 row0\" >violet</th>\n",
" <td id=\"T_7fb02_row0_col0\" class=\"data row0 col0\" >[0. 0. 0.]</td>\n",
" <td id=\"T_7fb02_row0_col1\" class=\"data row0 col1\" >[25.5 0. 25.5]</td>\n",
" <td id=\"T_7fb02_row0_col2\" class=\"data row0 col2\" >[51. 0. 51.]</td>\n",
" <td id=\"T_7fb02_row0_col3\" class=\"data row0 col3\" >[76.5 0. 76.5]</td>\n",
" <td id=\"T_7fb02_row0_col4\" class=\"data row0 col4\" >[102. 0. 102.]</td>\n",
" <td id=\"T_7fb02_row0_col5\" class=\"data row0 col5\" >[127.5 0. 127.5]</td>\n",
" <td id=\"T_7fb02_row0_col6\" class=\"data row0 col6\" >[153. 0. 153.]</td>\n",
" <td id=\"T_7fb02_row0_col7\" class=\"data row0 col7\" >[178.5 0. 178.5]</td>\n",
" <td id=\"T_7fb02_row0_col8\" class=\"data row0 col8\" >[204. 0. 204.]</td>\n",
" <td id=\"T_7fb02_row0_col9\" class=\"data row0 col9\" >[229.5 0. 229.5]</td>\n",
" <td id=\"T_7fb02_row0_col10\" class=\"data row0 col10\" >[255. 0. 255.]</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_7fb02_level0_row1\" class=\"row_heading level0 row1\" >yellow</th>\n",
" <td id=\"T_7fb02_row1_col0\" class=\"data row1 col0\" >[0. 0. 0.]</td>\n",
" <td id=\"T_7fb02_row1_col1\" class=\"data row1 col1\" >[25.5 25.5 0. ]</td>\n",
" <td id=\"T_7fb02_row1_col2\" class=\"data row1 col2\" >[51. 51. 0.]</td>\n",
" <td id=\"T_7fb02_row1_col3\" class=\"data row1 col3\" >[76.5 76.5 0. ]</td>\n",
" <td id=\"T_7fb02_row1_col4\" class=\"data row1 col4\" >[102. 102. 0.]</td>\n",
" <td id=\"T_7fb02_row1_col5\" class=\"data row1 col5\" >[127.5 127.5 0. ]</td>\n",
" <td id=\"T_7fb02_row1_col6\" class=\"data row1 col6\" >[153. 153. 0.]</td>\n",
" <td id=\"T_7fb02_row1_col7\" class=\"data row1 col7\" >[178.5 178.5 0. ]</td>\n",
" <td id=\"T_7fb02_row1_col8\" class=\"data row1 col8\" >[204. 204. 0.]</td>\n",
" <td id=\"T_7fb02_row1_col9\" class=\"data row1 col9\" >[229.5 229.5 0. ]</td>\n",
" <td id=\"T_7fb02_row1_col10\" class=\"data row1 col10\" >[255. 255. 0.]</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_7fb02_level0_row2\" class=\"row_heading level0 row2\" >cyan</th>\n",
" <td id=\"T_7fb02_row2_col0\" class=\"data row2 col0\" >[0. 0. 0.]</td>\n",
" <td id=\"T_7fb02_row2_col1\" class=\"data row2 col1\" >[ 0. 25.5 25.5]</td>\n",
" <td id=\"T_7fb02_row2_col2\" class=\"data row2 col2\" >[ 0. 51. 51.]</td>\n",
" <td id=\"T_7fb02_row2_col3\" class=\"data row2 col3\" >[ 0. 76.5 76.5]</td>\n",
" <td id=\"T_7fb02_row2_col4\" class=\"data row2 col4\" >[ 0. 102. 102.]</td>\n",
" <td id=\"T_7fb02_row2_col5\" class=\"data row2 col5\" >[ 0. 127.5 127.5]</td>\n",
" <td id=\"T_7fb02_row2_col6\" class=\"data row2 col6\" >[ 0. 153. 153.]</td>\n",
" <td id=\"T_7fb02_row2_col7\" class=\"data row2 col7\" >[ 0. 178.5 178.5]</td>\n",
" <td id=\"T_7fb02_row2_col8\" class=\"data row2 col8\" >[ 0. 204. 204.]</td>\n",
" <td id=\"T_7fb02_row2_col9\" class=\"data row2 col9\" >[ 0. 229.5 229.5]</td>\n",
" <td id=\"T_7fb02_row2_col10\" class=\"data row2 col10\" >[ 0. 255. 255.]</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n"
],
"text/plain": [
"<pandas.io.formats.style.Styler at 0x7efb92ceed90>"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
" secondary = pandas.concat([ \n",
" df.loc[\"red\"].add(df.loc[\"blue\"]).rename(\"violet\"),\n",
" df.loc[\"red\"].add(df.loc[\"green\"]).rename(\"yellow\"),\n",
" df.loc[\"blue\"].add(df.loc[\"green\"]).rename(\"cyan\")\n",
" ], axis=1).T; secondary.style.applymap(rgb)"
]
},
{
"cell_type": "markdown",
"id": "3f73e7dd-3151-4036-bf15-7df80683d765",
"metadata": {},
"source": [
"they can all be recombined together on their respective order."
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "78869c12-a572-4700-90dc-f73482b4090a",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style type=\"text/css\">\n",
"#T_5b15c_row0_col0, #T_5b15c_row1_col0, #T_5b15c_row2_col0, #T_5b15c_row3_col0, #T_5b15c_row4_col0, #T_5b15c_row5_col0 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 0.0);\n",
"}\n",
"#T_5b15c_row0_col1 {\n",
" font-size: 0px;\n",
" background-color: rgb(25.5, 0.0, 0.0);\n",
"}\n",
"#T_5b15c_row0_col2 {\n",
" font-size: 0px;\n",
" background-color: rgb(51.0, 0.0, 0.0);\n",
"}\n",
"#T_5b15c_row0_col3 {\n",
" font-size: 0px;\n",
" background-color: rgb(76.50000000000001, 0.0, 0.0);\n",
"}\n",
"#T_5b15c_row0_col4 {\n",
" font-size: 0px;\n",
" background-color: rgb(102.0, 0.0, 0.0);\n",
"}\n",
"#T_5b15c_row0_col5 {\n",
" font-size: 0px;\n",
" background-color: rgb(127.5, 0.0, 0.0);\n",
"}\n",
"#T_5b15c_row0_col6 {\n",
" font-size: 0px;\n",
" background-color: rgb(153.00000000000003, 0.0, 0.0);\n",
"}\n",
"#T_5b15c_row0_col7 {\n",
" font-size: 0px;\n",
" background-color: rgb(178.50000000000003, 0.0, 0.0);\n",
"}\n",
"#T_5b15c_row0_col8 {\n",
" font-size: 0px;\n",
" background-color: rgb(204.0, 0.0, 0.0);\n",
"}\n",
"#T_5b15c_row0_col9 {\n",
" font-size: 0px;\n",
" background-color: rgb(229.5, 0.0, 0.0);\n",
"}\n",
"#T_5b15c_row0_col10 {\n",
" font-size: 0px;\n",
" background-color: rgb(255.0, 0.0, 0.0);\n",
"}\n",
"#T_5b15c_row1_col1 {\n",
" font-size: 0px;\n",
" background-color: rgb(25.5, 0.0, 25.5);\n",
"}\n",
"#T_5b15c_row1_col2 {\n",
" font-size: 0px;\n",
" background-color: rgb(51.0, 0.0, 51.0);\n",
"}\n",
"#T_5b15c_row1_col3 {\n",
" font-size: 0px;\n",
" background-color: rgb(76.50000000000001, 0.0, 76.50000000000001);\n",
"}\n",
"#T_5b15c_row1_col4 {\n",
" font-size: 0px;\n",
" background-color: rgb(102.0, 0.0, 102.0);\n",
"}\n",
"#T_5b15c_row1_col5 {\n",
" font-size: 0px;\n",
" background-color: rgb(127.5, 0.0, 127.5);\n",
"}\n",
"#T_5b15c_row1_col6 {\n",
" font-size: 0px;\n",
" background-color: rgb(153.00000000000003, 0.0, 153.00000000000003);\n",
"}\n",
"#T_5b15c_row1_col7 {\n",
" font-size: 0px;\n",
" background-color: rgb(178.50000000000003, 0.0, 178.50000000000003);\n",
"}\n",
"#T_5b15c_row1_col8 {\n",
" font-size: 0px;\n",
" background-color: rgb(204.0, 0.0, 204.0);\n",
"}\n",
"#T_5b15c_row1_col9 {\n",
" font-size: 0px;\n",
" background-color: rgb(229.5, 0.0, 229.5);\n",
"}\n",
"#T_5b15c_row1_col10 {\n",
" font-size: 0px;\n",
" background-color: rgb(255.0, 0.0, 255.0);\n",
"}\n",
"#T_5b15c_row2_col1 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 25.5);\n",
"}\n",
"#T_5b15c_row2_col2 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 51.0);\n",
"}\n",
"#T_5b15c_row2_col3 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 76.50000000000001);\n",
"}\n",
"#T_5b15c_row2_col4 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 102.0);\n",
"}\n",
"#T_5b15c_row2_col5 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 127.5);\n",
"}\n",
"#T_5b15c_row2_col6 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 153.00000000000003);\n",
"}\n",
"#T_5b15c_row2_col7 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 178.50000000000003);\n",
"}\n",
"#T_5b15c_row2_col8 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 204.0);\n",
"}\n",
"#T_5b15c_row2_col9 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 229.5);\n",
"}\n",
"#T_5b15c_row2_col10 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 0.0, 255.0);\n",
"}\n",
"#T_5b15c_row3_col1 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 25.5, 25.5);\n",
"}\n",
"#T_5b15c_row3_col2 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 51.0, 51.0);\n",
"}\n",
"#T_5b15c_row3_col3 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 76.50000000000001, 76.50000000000001);\n",
"}\n",
"#T_5b15c_row3_col4 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 102.0, 102.0);\n",
"}\n",
"#T_5b15c_row3_col5 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 127.5, 127.5);\n",
"}\n",
"#T_5b15c_row3_col6 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 153.00000000000003, 153.00000000000003);\n",
"}\n",
"#T_5b15c_row3_col7 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 178.50000000000003, 178.50000000000003);\n",
"}\n",
"#T_5b15c_row3_col8 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 204.0, 204.0);\n",
"}\n",
"#T_5b15c_row3_col9 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 229.5, 229.5);\n",
"}\n",
"#T_5b15c_row3_col10 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 255.0, 255.0);\n",
"}\n",
"#T_5b15c_row4_col1 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 25.5, 0.0);\n",
"}\n",
"#T_5b15c_row4_col2 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 51.0, 0.0);\n",
"}\n",
"#T_5b15c_row4_col3 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 76.50000000000001, 0.0);\n",
"}\n",
"#T_5b15c_row4_col4 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 102.0, 0.0);\n",
"}\n",
"#T_5b15c_row4_col5 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 127.5, 0.0);\n",
"}\n",
"#T_5b15c_row4_col6 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 153.00000000000003, 0.0);\n",
"}\n",
"#T_5b15c_row4_col7 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 178.50000000000003, 0.0);\n",
"}\n",
"#T_5b15c_row4_col8 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 204.0, 0.0);\n",
"}\n",
"#T_5b15c_row4_col9 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 229.5, 0.0);\n",
"}\n",
"#T_5b15c_row4_col10 {\n",
" font-size: 0px;\n",
" background-color: rgb(0.0, 255.0, 0.0);\n",
"}\n",
"#T_5b15c_row5_col1 {\n",
" font-size: 0px;\n",
" background-color: rgb(25.5, 25.5, 0.0);\n",
"}\n",
"#T_5b15c_row5_col2 {\n",
" font-size: 0px;\n",
" background-color: rgb(51.0, 51.0, 0.0);\n",
"}\n",
"#T_5b15c_row5_col3 {\n",
" font-size: 0px;\n",
" background-color: rgb(76.50000000000001, 76.50000000000001, 0.0);\n",
"}\n",
"#T_5b15c_row5_col4 {\n",
" font-size: 0px;\n",
" background-color: rgb(102.0, 102.0, 0.0);\n",
"}\n",
"#T_5b15c_row5_col5 {\n",
" font-size: 0px;\n",
" background-color: rgb(127.5, 127.5, 0.0);\n",
"}\n",
"#T_5b15c_row5_col6 {\n",
" font-size: 0px;\n",
" background-color: rgb(153.00000000000003, 153.00000000000003, 0.0);\n",
"}\n",
"#T_5b15c_row5_col7 {\n",
" font-size: 0px;\n",
" background-color: rgb(178.50000000000003, 178.50000000000003, 0.0);\n",
"}\n",
"#T_5b15c_row5_col8 {\n",
" font-size: 0px;\n",
" background-color: rgb(204.0, 204.0, 0.0);\n",
"}\n",
"#T_5b15c_row5_col9 {\n",
" font-size: 0px;\n",
" background-color: rgb(229.5, 229.5, 0.0);\n",
"}\n",
"#T_5b15c_row5_col10 {\n",
" font-size: 0px;\n",
" background-color: rgb(255.0, 255.0, 0.0);\n",
"}\n",
"</style>\n",
"<table id=\"T_5b15c_\">\n",
" <thead>\n",
" <tr>\n",
" <th class=\"blank level0\" >&nbsp;</th>\n",
" <th class=\"col_heading level0 col0\" >0</th>\n",
" <th class=\"col_heading level0 col1\" >1</th>\n",
" <th class=\"col_heading level0 col2\" >2</th>\n",
" <th class=\"col_heading level0 col3\" >3</th>\n",
" <th class=\"col_heading level0 col4\" >4</th>\n",
" <th class=\"col_heading level0 col5\" >5</th>\n",
" <th class=\"col_heading level0 col6\" >6</th>\n",
" <th class=\"col_heading level0 col7\" >7</th>\n",
" <th class=\"col_heading level0 col8\" >8</th>\n",
" <th class=\"col_heading level0 col9\" >9</th>\n",
" <th class=\"col_heading level0 col10\" >10</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th id=\"T_5b15c_level0_row0\" class=\"row_heading level0 row0\" >red</th>\n",
" <td id=\"T_5b15c_row0_col0\" class=\"data row0 col0\" >[0. 0. 0.]</td>\n",
" <td id=\"T_5b15c_row0_col1\" class=\"data row0 col1\" >[25.5 0. 0. ]</td>\n",
" <td id=\"T_5b15c_row0_col2\" class=\"data row0 col2\" >[51. 0. 0.]</td>\n",
" <td id=\"T_5b15c_row0_col3\" class=\"data row0 col3\" >[76.5 0. 0. ]</td>\n",
" <td id=\"T_5b15c_row0_col4\" class=\"data row0 col4\" >[102. 0. 0.]</td>\n",
" <td id=\"T_5b15c_row0_col5\" class=\"data row0 col5\" >[127.5 0. 0. ]</td>\n",
" <td id=\"T_5b15c_row0_col6\" class=\"data row0 col6\" >[153. 0. 0.]</td>\n",
" <td id=\"T_5b15c_row0_col7\" class=\"data row0 col7\" >[178.5 0. 0. ]</td>\n",
" <td id=\"T_5b15c_row0_col8\" class=\"data row0 col8\" >[204. 0. 0.]</td>\n",
" <td id=\"T_5b15c_row0_col9\" class=\"data row0 col9\" >[229.5 0. 0. ]</td>\n",
" <td id=\"T_5b15c_row0_col10\" class=\"data row0 col10\" >[255. 0. 0.]</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_5b15c_level0_row1\" class=\"row_heading level0 row1\" >violet</th>\n",
" <td id=\"T_5b15c_row1_col0\" class=\"data row1 col0\" >[0. 0. 0.]</td>\n",
" <td id=\"T_5b15c_row1_col1\" class=\"data row1 col1\" >[25.5 0. 25.5]</td>\n",
" <td id=\"T_5b15c_row1_col2\" class=\"data row1 col2\" >[51. 0. 51.]</td>\n",
" <td id=\"T_5b15c_row1_col3\" class=\"data row1 col3\" >[76.5 0. 76.5]</td>\n",
" <td id=\"T_5b15c_row1_col4\" class=\"data row1 col4\" >[102. 0. 102.]</td>\n",
" <td id=\"T_5b15c_row1_col5\" class=\"data row1 col5\" >[127.5 0. 127.5]</td>\n",
" <td id=\"T_5b15c_row1_col6\" class=\"data row1 col6\" >[153. 0. 153.]</td>\n",
" <td id=\"T_5b15c_row1_col7\" class=\"data row1 col7\" >[178.5 0. 178.5]</td>\n",
" <td id=\"T_5b15c_row1_col8\" class=\"data row1 col8\" >[204. 0. 204.]</td>\n",
" <td id=\"T_5b15c_row1_col9\" class=\"data row1 col9\" >[229.5 0. 229.5]</td>\n",
" <td id=\"T_5b15c_row1_col10\" class=\"data row1 col10\" >[255. 0. 255.]</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_5b15c_level0_row2\" class=\"row_heading level0 row2\" >blue</th>\n",
" <td id=\"T_5b15c_row2_col0\" class=\"data row2 col0\" >[0. 0. 0.]</td>\n",
" <td id=\"T_5b15c_row2_col1\" class=\"data row2 col1\" >[ 0. 0. 25.5]</td>\n",
" <td id=\"T_5b15c_row2_col2\" class=\"data row2 col2\" >[ 0. 0. 51.]</td>\n",
" <td id=\"T_5b15c_row2_col3\" class=\"data row2 col3\" >[ 0. 0. 76.5]</td>\n",
" <td id=\"T_5b15c_row2_col4\" class=\"data row2 col4\" >[ 0. 0. 102.]</td>\n",
" <td id=\"T_5b15c_row2_col5\" class=\"data row2 col5\" >[ 0. 0. 127.5]</td>\n",
" <td id=\"T_5b15c_row2_col6\" class=\"data row2 col6\" >[ 0. 0. 153.]</td>\n",
" <td id=\"T_5b15c_row2_col7\" class=\"data row2 col7\" >[ 0. 0. 178.5]</td>\n",
" <td id=\"T_5b15c_row2_col8\" class=\"data row2 col8\" >[ 0. 0. 204.]</td>\n",
" <td id=\"T_5b15c_row2_col9\" class=\"data row2 col9\" >[ 0. 0. 229.5]</td>\n",
" <td id=\"T_5b15c_row2_col10\" class=\"data row2 col10\" >[ 0. 0. 255.]</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_5b15c_level0_row3\" class=\"row_heading level0 row3\" >cyan</th>\n",
" <td id=\"T_5b15c_row3_col0\" class=\"data row3 col0\" >[0. 0. 0.]</td>\n",
" <td id=\"T_5b15c_row3_col1\" class=\"data row3 col1\" >[ 0. 25.5 25.5]</td>\n",
" <td id=\"T_5b15c_row3_col2\" class=\"data row3 col2\" >[ 0. 51. 51.]</td>\n",
" <td id=\"T_5b15c_row3_col3\" class=\"data row3 col3\" >[ 0. 76.5 76.5]</td>\n",
" <td id=\"T_5b15c_row3_col4\" class=\"data row3 col4\" >[ 0. 102. 102.]</td>\n",
" <td id=\"T_5b15c_row3_col5\" class=\"data row3 col5\" >[ 0. 127.5 127.5]</td>\n",
" <td id=\"T_5b15c_row3_col6\" class=\"data row3 col6\" >[ 0. 153. 153.]</td>\n",
" <td id=\"T_5b15c_row3_col7\" class=\"data row3 col7\" >[ 0. 178.5 178.5]</td>\n",
" <td id=\"T_5b15c_row3_col8\" class=\"data row3 col8\" >[ 0. 204. 204.]</td>\n",
" <td id=\"T_5b15c_row3_col9\" class=\"data row3 col9\" >[ 0. 229.5 229.5]</td>\n",
" <td id=\"T_5b15c_row3_col10\" class=\"data row3 col10\" >[ 0. 255. 255.]</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_5b15c_level0_row4\" class=\"row_heading level0 row4\" >green</th>\n",
" <td id=\"T_5b15c_row4_col0\" class=\"data row4 col0\" >[0. 0. 0.]</td>\n",
" <td id=\"T_5b15c_row4_col1\" class=\"data row4 col1\" >[ 0. 25.5 0. ]</td>\n",
" <td id=\"T_5b15c_row4_col2\" class=\"data row4 col2\" >[ 0. 51. 0.]</td>\n",
" <td id=\"T_5b15c_row4_col3\" class=\"data row4 col3\" >[ 0. 76.5 0. ]</td>\n",
" <td id=\"T_5b15c_row4_col4\" class=\"data row4 col4\" >[ 0. 102. 0.]</td>\n",
" <td id=\"T_5b15c_row4_col5\" class=\"data row4 col5\" >[ 0. 127.5 0. ]</td>\n",
" <td id=\"T_5b15c_row4_col6\" class=\"data row4 col6\" >[ 0. 153. 0.]</td>\n",
" <td id=\"T_5b15c_row4_col7\" class=\"data row4 col7\" >[ 0. 178.5 0. ]</td>\n",
" <td id=\"T_5b15c_row4_col8\" class=\"data row4 col8\" >[ 0. 204. 0.]</td>\n",
" <td id=\"T_5b15c_row4_col9\" class=\"data row4 col9\" >[ 0. 229.5 0. ]</td>\n",
" <td id=\"T_5b15c_row4_col10\" class=\"data row4 col10\" >[ 0. 255. 0.]</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_5b15c_level0_row5\" class=\"row_heading level0 row5\" >yellow</th>\n",
" <td id=\"T_5b15c_row5_col0\" class=\"data row5 col0\" >[0. 0. 0.]</td>\n",
" <td id=\"T_5b15c_row5_col1\" class=\"data row5 col1\" >[25.5 25.5 0. ]</td>\n",
" <td id=\"T_5b15c_row5_col2\" class=\"data row5 col2\" >[51. 51. 0.]</td>\n",
" <td id=\"T_5b15c_row5_col3\" class=\"data row5 col3\" >[76.5 76.5 0. ]</td>\n",
" <td id=\"T_5b15c_row5_col4\" class=\"data row5 col4\" >[102. 102. 0.]</td>\n",
" <td id=\"T_5b15c_row5_col5\" class=\"data row5 col5\" >[127.5 127.5 0. ]</td>\n",
" <td id=\"T_5b15c_row5_col6\" class=\"data row5 col6\" >[153. 153. 0.]</td>\n",
" <td id=\"T_5b15c_row5_col7\" class=\"data row5 col7\" >[178.5 178.5 0. ]</td>\n",
" <td id=\"T_5b15c_row5_col8\" class=\"data row5 col8\" >[204. 204. 0.]</td>\n",
" <td id=\"T_5b15c_row5_col9\" class=\"data row5 col9\" >[229.5 229.5 0. ]</td>\n",
" <td id=\"T_5b15c_row5_col10\" class=\"data row5 col10\" >[255. 255. 0.]</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n"
],
"text/plain": [
"<pandas.io.formats.style.Styler at 0x7efb941a08b0>"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
" all = pandas.concat([df, secondary]).loc[\n",
" \"red violet blue cyan green yellow\".split()]\n",
"\n",
" all.style.applymap(rgb)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c0542389-e5ee-4b27-90f7-17a74403988d",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment