In your case, some of the values appeared to be floats, not strings. So, in order to get rid of this error do one thing just change those values into strings before passing them to re.sub. One simple way is to change location to str(location) when using re.sub. It wouldn't hurt to do it anyway even if it's already a str.
letters_only = re.sub("[^a-zA-Z]", # Search for all non-letters
" ", # Replace all non-letters with spaces
str(location))
If you want to learn python, visit this Python tutorial and Python course.