I have a Python dataframe like this with one column:
index Train_station
0 Adenauerplatz 52° 29′ 59″ N, 13° 18′ 26″ O
1 Afrikanische Straße 52° 33′ 38″ N, 13° 20′ 3″ O
2 Alexanderplatz 52° 31′ 17″ N, 13° 24′ 48″ O
And I want to split it into 3 columns: Train station, Latitude, Longitude. The dataframe should look like this:
index Train_station Latitude Longitude
0 Adenauerplatz 52° 29′ 59″ N 13° 18′ 26″ O
1 Afrikanische Straße 52° 33′ 38″ N 13° 20′ 3″ O
2 Alexanderplatz 52° 31′ 17″ N 13° 24′ 48″ O
I've tried using df[['Latitude', 'Longitude']] = df.Train_station.str.split(',', expand=True) but it only split between latitude and longitude coordinates. How can I split a column with more than one condition that I define?
I've thought about method to check the string starting from the left and then split the when it meets an integer or the defined string but I've found no answer for this method so far.