1

I have many files from OECD that have data available for different regional granularities. An example would be:

File A

REG_ID Region
AUS    Australia
AU1GS  Sydney
AU1    New South Wales
AU2    Victoria
AU2GM  Melbourne

File B

REG_ID Region
AUS    Australia
AU1GS  Sydney
AU2GM  Melbourne

File C

REG_ID Region
AUS    Australia
AU1    New South Wales
AU1GS  Sydney
AU2    Victoria

I want to extract the most granular region, in this case Sydney only, and not New South Wales. However, if Sydney is unavailable, I want to extract New South Wales.

How do I write code that is generalisable to all these files?

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
stochastiq
  • 269
  • 3
  • 17

0 Answers0