REF: `axis in [...]` becomes `_get_axis_number(axis)` in Styler
- [x] addresses an item in #43048 

Hello @yashbg! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:



There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2021-08-27 16:42:42 UTC > Thanks - I must have missed this one. small comment.

I think it was added after you made the changes. Happy to contribute! LGTM pending green tests This gets a mypy error. Not sure why, I think its a curious case of ordering the conditional and it breaks. I've seen this before. See if you can fix it. Failing that can always try adding `assert result is DataFrame` before the mypy errror.  > This gets a mypy error. Not sure why, I think its a curious case of ordering the conditional and it breaks. I've seen this before. See if you can fix it. Failing that can always try adding `assert result is DataFrame` before the mypy errror.

isn't this because `func` is annotated to return a `Styler`? (I'll try checking this out later) Yes good spot. Not sure why mypy didn't complain on previous implementation...  I think it's because `apply` has its return untyped, so it was being detected as `Any` I think it's because of the change in the ordering of the conditional statements. Earlier the first assignment of `result` was annotated to be of the type `Any`, but now it is a `Styler`, so that might be the reason mypy is causing an error. As mentioned in the mypy docs:

> Mypy generally uses the first assignment to a variable to infer the type of the variable.

So one solution would be to change the ordering of the conditional statements again. Or I could annotate the type of `result` explicitly. Alternatively, I could also use something like a temporary variable to take the output of `func()` and then typecast it to `DataFrame` and assign it to `result` separately, as is done in the `if not isinstance(result, DataFrame)` block. Which method should I follow?  I would attempt to correct any annotations that might be wrong, its a cleaner and more transparent approach > I would attempt to correct any annotations that might be wrong, its a cleaner and more transparent approach

The problem is that `result` is being initialized as a `Style` but eventually it is being converted to a `DataFrame` only, which mypy is not able to understand. So I guess explicitly annotating `result` as a `DataFrame` could be a reasonable solution. 

Otherwise, I think the only annotation which could be changed would be of `func()`, we could remove the `Styler` annotation from it, but I'm not sure about this.  lets see how #43148 works in the CI (continuous integration tests). You might be able to merge/update your PR after that #43148 seems to have passed the tests. Once it is merged I'll update this PR and hopefully it will work.  @attack68 will #43148 be merged or should I make those changes in this PR itself? @yashbg that PR should be merged, just waiting on its review, but it passes all tests and is green. You can add it here if you like. Either this will then be merged with changes and I close the other, or mine is merged first and when you pull you have same changes so no problems. > @yashbg that PR should be merged, just waiting on its review, but it passes all tests and is green. You can add it here if you like. Either this will then be merged with changes and I close the other, or mine is merged first and when you pull you have same changes so no problems.

It has been merged. So I'll pull those changes and update my PR.  The checks seem to have passed. Now the remaining workflows need approval.  All the checks have finally passed. I think it can be merged now.  @attack68 could you please review the changes you had requested in the beginning? Then I think the PR can be merged. 