From 74d6019b4a676dcb143b39db573270ccec343632 Mon Sep 17 00:00:00 2001 From: ppulkit05 Date: Fri, 20 Aug 2021 17:38:31 +0530 Subject: [PATCH] REF: use _get_axis_number instead of if axis in [...]: #43048 --- pandas/io/formats/style.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index 81bd14629cfd3..32dfdabbf58bb 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -1148,9 +1148,9 @@ def _apply( subset = slice(None) if subset is None else subset subset = non_reducing_slice(subset) data = self.data.loc[subset] - if axis in [0, "index"]: + if axis == 0 and "index": result = data.apply(func, axis=0, **kwargs) - elif axis in [1, "columns"]: + elif axis == 1 and "columns": result = data.T.apply(func, axis=0, **kwargs).T # see GH 42005 else: result = func(data, **kwargs)