Describe the bug
This is an extension of #919 which was fixed by #921.
There's a few Styler functions that accept **kwargs being passed to func, but the stubs only support **kwargs in the func signature for Styler.apply(). I'm working with apply_index right now, but map and map_index both should be able to accept **kwargs according to the docs.
To Reproduce
import numpy as np
import pandas as pd
def highlight_odd(index: pd.Series, /, color: str) -> list[str]:
style = [f"color: {color}" if x % 2 else "" for x in index]
return style
df = pd.DataFrame(np.random.randint(0, high=100, size=(10, 3)))
styler = df.style.apply_index(highlight_odd, color='red')
styler.to_html("output.html")
Using pyright:
Type "(index: Series[Any], /, color: str) -> list[str]" is not assignable to type "(Series[Any]) -> (NDArray[str_] | list[str] | Series[str])"
Extra parameter "color" (reportArgumentType)
1 error, 0 warnings, 0 informations
Please complete the following information:
- OS: [e.g. Windows, Linux, MacOS]
- OS Version: 26.3.1
- python version: 3.12.12
- version of type checker:
pyright 1.1.408
- version of installed
pandas-stubs: 3.0.0.260204
Describe the bug
This is an extension of #919 which was fixed by #921.
There's a few
Stylerfunctions that accept**kwargsbeing passed tofunc, but the stubs only support**kwargsin thefuncsignature forStyler.apply(). I'm working withapply_indexright now, butmapandmap_indexboth should be able to accept**kwargsaccording to the docs.To Reproduce
Using
pyright:Please complete the following information:
pyright 1.1.408pandas-stubs: 3.0.0.260204