From 1444ce402a4c31c72651635a3dc00aa9e51849fa Mon Sep 17 00:00:00 2001 From: Glenn Sugar Date: Sun, 11 Dec 2022 20:17:15 -0500 Subject: [PATCH] Fix lambda function in multiindex_strategy to handle str dtypes Signed-off-by: Glenn Sugar --- pandera/strategies/pandas_strategies.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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()):