'looping over one column to get match and grab value from other columns
I have the following loop working. It is giving me the volcanoes match: True or False, but I would like to bring other columns from the volcano19_20 dataframe also like: latitude, longitude, name if is True if its False it can be nan.
How to modify this loop to get not only True/False in volcanoes[].
volcanoes = []
for date in earthquakes19_20['date']:
volcanoes.append(date in volcano19_20['date'].unique()
or date + timedelta(days=1) in volcano19_20['date'].unique()
or date + timedelta(days=2) in volcano19_20['date'].unique()
or date + timedelta(days=3) in volcano19_20['date'].unique())
earthquakes19_20['vol_match'] = volcanoes
sample of earthquake19_20 df:
sample of volcano19_20 df:
I have appended the earthquake19_20 with the volcanoes[] column (True/False) but would like to get also Latitude[], Longitude[], Volcano name[] from the volcano dataset. I hope this make sense.
desired output:
what I have right now is the part in bold and need the last 3 columns.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|



