I've got a .txt file that looks like this:
id nm lat lon countryCode
5555555 London 55.876456 99.546231 UK
I need to parse each field and add them to a SQLite database. So far I've managed to transfer into my db the id, name and countryCode columns, but I'm struggling to find a solution to parse the lat and lon of each record individually.
I tried with regex, but no luck. I also thought about making a parser to check if the last non-whitespace char is a letter, to determine that the string is lat and not lon, but have no idea how to implement it correctly. Can I solve it using regex or should I use a custom parser? if so, how?
df = pandas.read_csv('file_path', sep='\t')
And then insert the entire dataframe into your SQLite db.