1
Good afternoon!
I’m having a hard time separating the name of the countries into a string column (text), where I don’t have a common separator, I’m not even sure where to start.
Basically, my idea was to start counting back from http and stop at the first comma (meaning <), but I couldn’t do it. (maybe there’s some other smarter way to start).
text
7.5 magnitude #earthquake. 92 km from Sand Point, #AK, United States https://t.co/XjKbyhjl7v
7.0 magnitude #earthquake. 14 km from Néon Karlovásion, North Aegean, #Greece https://t.co/Mam1KkK2z7
7.4 magnitude #earthquake. 94 km from #SandPoint, AK, #UnitedStates https://t.co/gqdJzjfyVU
7.4 magnitude #earthquake. 94 km from #SandPoint, AK, United States https://t.co/gqdJzjfyVU
5.7 magnitude #earthquake. 295 km from Lospalos, #LA, East Timor https://t.co/rGvz9nC2Iv
1.7 magnitude #earthquake. 4 km from Redwood Valley, CA, #UnitedStates https://t.co/lEnnEDqrLO
4.2 magnitude #earthquake. 92 km from La Esperanza (El Zapotal), #Chiapas, Mexico https://t.co/6SUWsNjDd1
5.5 magnitude #earthquake. 50 km from #Oxapampa, Pasco, Peru https://t.co/Z95OMBWLsw
Complete dataframe in the file below, the column in question is the last: https://drive.google.com/file/d/1_Iz-c-iKuC2HnsMOlcwfugzCZ9r0-Wug/view?usp=sharing
Obs: I had to do something at a more easy level to remove the first two numbers that inform the magnitude of the earthquakes, it was easy using the:
df['Magnitude'] = df['text'].str[:3].astype(float)
print(df.Magnitude)
The link to the file is closed
– Lucas
@Lucas shared again, this time tested on an anonymous tab and is open, I believe it will work.
– fellipeao