11. Parklife¶
World events have lead to an increase in the popularity and usage of local parks. But which is the best park to take a stroll in ? Let’s look at the Royal Parks of London depicted in art and medical collections to answer this question comprehensively, from an artistic and scientific viewpoint.
First we need to list the major Royal Parks (with apologies to Kensington Gardens, Brompton Cemetary and Victoria Tower Gardens that don’t make the list)
royal_parks = (
"Hyde Park",
"Richmond Park",
"Bushy Park",
"Green Park",
"St James's Park",
"Regent's Park",
"Greenwich Park")
Wellcome Collection¶
We can use the Wellcome API to get matching objects.
import requests
import pandas as pd
from urllib.parse import quote
wellcome_royal_parks_df = pd.DataFrame()
for park in royal_parks:
req = requests.get(f"https://api.wellcomecollection.org/catalogue/v2/works?query={quote(park)}&aggregations=workType")
wellcome_park_json = req.json()
park_objects = []
for workType in wellcome_park_json['aggregations']['workType']['buckets']:
park_objects.append([park, workType['data']['label'], workType['count']])
park_objects_df = pd.DataFrame(park_objects, columns=['Park', 'Label', 'Count'])
wellcome_royal_parks_df = wellcome_royal_parks_df.append(park_objects_df)
wellcome_royal_parks_df.sample(5)
Park | Label | Count | |
---|---|---|---|
4 | Richmond Park | Digital Images | 1 |
2 | Regent's Park | Archives and manuscripts | 24 |
0 | Greenwich Park | Books | 47 |
2 | Hyde Park | Pictures | 39 |
2 | Bushy Park | Pictures | 5 |
Now we have the data, we can generate the graph showing which park is the most popular at Wellcome.
import altair as alt
from vega_datasets import data
alt.Chart(wellcome_royal_parks_df).mark_bar(
cornerRadiusTopLeft=3,
cornerRadiusTopRight=3
).encode(
y='Park',
x='Count:Q',
color='Label:N').configure_legend(
columns=5,
orient='right',
clipHeight=20,
symbolLimit=60).properties(
height=250)
So, for Wellcome Collection, Green Park is the place to be. However, taking a look at some of the items in more detail, there might be an element of fuzzy search going on here, as not all the results are about the “Green Park” in London. But regardless of this, we can see Richmond Park is not very extensively represented in Wellcome’s collections.
V&A at the Park¶
Now to run the same query against the V&A collections
import requests
import pandas as pd
from urllib.parse import quote
royal_parks = (
"Hyde Park",
"Richmond Park",
"Bushy Park",
"Green Park",
"St James's Park",
"Regent's Park",
"Greenwich Park")
vam_royal_parks_df = pd.DataFrame()
park_objects = None
for park in royal_parks:
park_objects = pd.read_json(f'https://api.vam.ac.uk/v2/objects/clusters/object_type/search?q="{quote(park)}"')
# Potentially remove some object types with very low counts to make the graphic more readable
# park_objects.drop( park_objects[ park_objects['count'] < 5 ].index, inplace=True)
park_objects['park'] = park
vam_royal_parks_df = vam_royal_parks_df.append(park_objects)
import altair as alt
from vega_datasets import data
alt.Chart(vam_royal_parks_df).mark_bar(
cornerRadiusTopLeft=3,
cornerRadiusTopRight=3
).encode(
y='park',
x='count:Q',
color='value:N').configure_legend(
columns=5,
orient='right',
clipHeight=20,
symbolLimit=60).properties(
height=250)
A clear victory for Hyde Park there (helped hugely by the Great Exhibition), and perhaps Bushy Park is a bit too exclusive to be drawn or painted. As with Wellcome, some of these items are not really related to the park, but just have the name in the title or description somewhere. A more precise count could be achieved by using a place filter instead, but not all the parks have identifiers, so a text search has to do for now.
Conclusion¶
Further research is needed, involving picnics.