diff --git a/pandera/strategies/pandas_strategies.py b/pandera/strategies/pandas_strategies.py index 6a34241d2..be011e590 100644 --- a/pandera/strategies/pandas_strategies.py +++ b/pandera/strategies/pandas_strategies.py @@ -1192,7 +1192,7 @@ def multiindex_strategy( if dtype in {"object", "str"} or dtype.startswith("string"): # pylint: disable=cell-var-from-loop,undefined-loop-variable strategy = strategy.map( - lambda df: df.assign(**{name: df[name].map(str)}) + lambda df, name=name: df.assign(**{name: df[name].map(str)}) ) if any(nullable_index.values()):