Skip to main content
1 of 2
Micha
  • 15.8k
  • 23
  • 29

If you prepare your where clause first, it should work (I use f-strings below):

  for index, row in df.iterrows():
        city_code = (row['city_ID'])
        expr = f"city_ID={city_code}"
        out = f"out_{city_code}"
        grass.run_command('v.extract', overwrite=True, input='six_cities', output=out, where=expr)
Micha
  • 15.8k
  • 23
  • 29