a guest Aug 14th, 2019 58 in 6 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def country(dframe):
  2.     country_codes = []
  3.     for obs in dframe['station identifier']:
  4.         word = " ".join(re.findall("[a-zA-Z]+", obs))
  5.         if len(word) >3: #fandt en bug
  6.             country_codes.append(word[:3])
  7.         else:
  8.             country_codes.append(word)
  9.     dframe['lande'] = country_codes
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand