This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Example of how to open a debugger anywhere in the middle of a pandas method chain.""" | |
import numpy as np | |
import seaborn as sns | |
from IPython.core.debugger import Pdb | |
df = sns.load_dataset("iris") | |
df = ( | |
df.assign(sepal_ratio=lambda x: np.divide(x["sepal_width"], x["sepal_length"])) | |
.pipe(lambda x: Pdb().set_trace()) # Opens the debugger, the dataframe is assigned to `x` |