When a script ends and I still want to poke at its data, I do not add print lines, I ask python to stay.
python3 -i script.py
>>> df.head()
>>> _
-i runs the script and then opens the interactive prompt in the same namespace, so every global, function and open object is still there. It also drops you at the prompt after an uncaught exception, which lets you inspect the state with import pdb; pdb.pm(). In the prompt, _ holds the result of the last expression. Setting PYTHONINSPECT=1 in the environment has the same effect without changing the command.
Further reading: Python command line documentation