Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# LOC Colors - Data Management"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*Export data as minimal JSON files - only the essentials to create the swatches in the browser*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To use the created swatches for [https://labs.onb.ac.at/en/topic/akon-swatches/](https://labs.onb.ac.at/en/topic/akon-swatches/), I have to create a JSON file looking like this:\n",
"\n",
"```json\n",
"[[\"AK111_461\", [\"#f4e6cd\", \"#cac4b2\", \"#7e8077\", \"#3e4139\", \"#2f3431\", \"#000304\"], \"Nonza\", \"gelaufen 1903\"],\n",
"[\"AK111_072\", [\"#e2d7c1\", \"#a19c8f\", \"#504e42\", \"#494a44\", \"#010500\", \"#393c39\"], \"Kirchberg am Walde\", \"gelaufen 1914\"],\n",
"[\"AK111_077\", [\"#454234\", \"#3e3b1f\", \"#7f7e77\", \"#a9b8be\", \"#3b4347\", \"#425a6b\"], \"Kirchberg am Wechsel\", \"gelaufen 1913\"]]\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The first part (the id and the colors) are part of the created swatches, the second part (a name and an approximate date) are part of the metadata to download here: [https://labs.onb.ac.at/gitlab/labs-team/raw-metadata/raw/master/akon_postcards_public_domain.csv.bz2?inline=false](https://labs.onb.ac.at/gitlab/labs-team/raw-metadata/raw/master/akon_postcards_public_domain.csv.bz2?inline=false)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Read created swatches"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv('historic_postcards_color_swatches.csv.bz2', compression='bz2')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"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>Unnamed: 0</th>\n",
" <th>akon_id</th>\n",
" <th>image_link</th>\n",
" <th>hex_colors</th>\n",
" <th>html</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>21914</th>\n",
" <td>21914</td>\n",
" <td>AK036_405</td>\n",
" <td>https://iiif.onb.ac.at/images/AKON/AK036_405/4...</td>\n",
" <td>['#f2e3c1', '#e6dec6', '#8e8a7a', '#7b7864', '...</td>\n",
" <td><a href=\"https://iiif.onb.ac.at/images/AKON/AK...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Unnamed: 0 akon_id \\\n",
"21914 21914 AK036_405 \n",
"\n",
" image_link \\\n",
"21914 https://iiif.onb.ac.at/images/AKON/AK036_405/4... \n",
"\n",
" hex_colors \\\n",
"21914 ['#f2e3c1', '#e6dec6', '#8e8a7a', '#7b7864', '... \n",
"\n",
" html \n",
"21914 <a href=\"https://iiif.onb.ac.at/images/AKON/AK... "
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.sample()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Only keep the necessary columns"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"id_and_hex_colors = df[['akon_id', 'hex_colors']].copy()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"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>akon_id</th>\n",
" <th>hex_colors</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>14980</th>\n",
" <td>AK010_595</td>\n",
" <td>['#cfbfa4', '#62583b', '#c8c7b6', '#4f5144', '...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7474</th>\n",
" <td>AK084_243</td>\n",
" <td>['#aca693', '#414028', '#444537', '#5c5f57', '...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23730</th>\n",
" <td>AK043_578</td>\n",
" <td>['#4e502c', '#444735', '#51554a', '#dae1d1', '...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>30352</th>\n",
" <td>AK085_096</td>\n",
" <td>['#b5aa9d', '#f3e7d7', '#756d62', '#211a0f', '...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22389</th>\n",
" <td>AK038_067</td>\n",
Loading full blame...