File size: 815 Bytes
c838930
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Q: Wieviele {{gefaess_typ_txt}} gibt es in Zürich?
# Relevant datasets: ['Abfallgefässe']

import geopandas as gpd
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("gefaess_typ_txt", type=str)
args = parser.parse_args()

### Solution ###
gdf_abfall = gpd.read_file("./data/opendata/50000006/extracted/abfallgefaesse.gpkg", layer="erz.abfallgefaess_p")

if args.gefaess_typ_txt.strip() == "Abfallhaie":
    gefaess_typ = 5
elif args.gefaess_typ_txt.strip() == "Robidogs":
    gefaess_typ = 0
elif args.gefaess_typ_txt.strip() == "Zürikübel":
    gefaess_typ = 4
else:
    raise ValueError(f"Unknown gefaess_typ_txt: {args.gefaess_typ_txt}")

gefaess_count = gdf_abfall[gdf_abfall["gefaesstyp"] == gefaess_typ].shape[0] # using gefaesstyp_txt yields identical results
print(gefaess_count)