Get row with NaN as well as preceding and following NaN row
Advertisements I have the following snippet from an example dataframe: df = pd.DataFrame({‘location’: [‘Seattle’, np.nan, ‘Portland’, ‘San Francisco’], ‘time’: [‘2022-06-01 12:00:00’, ‘2022-06-01 13:00:00’, ‘2022-06-01 14:00:00’, ‘2022-06-01 15:00:00’]}) I would like to retrieve the rows where location = nan as well as the non-nan row above and below. So that it will be as such df… Read More Get row with NaN as well as preceding and following NaN row