Skip to content

Commit d2af9b8

Browse files
committed
Create 2022-04-02-saving-css3-dict.ipynb
1 parent 6518617 commit d2af9b8

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

2022-04-02-saving-css3-dict.ipynb

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 2,
6+
"id": "13fb96bf",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"import webcolors\n",
11+
"import pandas as pd\n",
12+
"pd.options.display.max_columns = 7"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": 20,
18+
"id": "5cbe38f8",
19+
"metadata": {},
20+
"outputs": [],
21+
"source": [
22+
"CSS3_NAMES_TO_HEX = pd.DataFrame.from_dict(webcolors.CSS3_NAMES_TO_HEX, orient = \"index\")\n",
23+
"CSS3_NAMES_TO_HEX.reset_index(inplace=True)\n",
24+
"CSS3_NAMES_TO_HEX.rename(columns = {\"index\":\"color\", 0:\"hex\"}, inplace=True)"
25+
]
26+
},
27+
{
28+
"cell_type": "code",
29+
"execution_count": 21,
30+
"id": "d5febdd0",
31+
"metadata": {},
32+
"outputs": [],
33+
"source": [
34+
"CSS3_NAMES_TO_HEX.to_csv(\"C:\\\\Users\\\\chris\\\\Desktop\\\\CSS3_NAMES_TO_HEX.csv\", index=False)"
35+
]
36+
}
37+
],
38+
"metadata": {
39+
"kernelspec": {
40+
"display_name": "Python 3 (ipykernel)",
41+
"language": "python",
42+
"name": "python3"
43+
},
44+
"language_info": {
45+
"codemirror_mode": {
46+
"name": "ipython",
47+
"version": 3
48+
},
49+
"file_extension": ".py",
50+
"mimetype": "text/x-python",
51+
"name": "python",
52+
"nbconvert_exporter": "python",
53+
"pygments_lexer": "ipython3",
54+
"version": "3.10.2"
55+
}
56+
},
57+
"nbformat": 4,
58+
"nbformat_minor": 5
59+
}

0 commit comments

Comments
 (0)