In cell 1 I create a Pandas dataframe with:
df = pd.read_csv(...)
In the next cell (cell 2) I perform some operations on that dataframe. However, if there’s an error in that second cell, or I leave too much time between executing cells 1 and 2 I get the following error:
RuntimeError: Can't use object "df" outside of the cell where it's defined
I have to re-run cell 1 before I can execute cell 2. This is really frustrating, as creating this dataframe takes a non-negligible amount of time.
Is there any way to avoid this happening?