Closed
Description
Describe the bug
pandas Styler
has no .columns
attr defined in the stubs.
To Reproduce
- Minimal example, save in a file named
t.py
from typing import reveal_type
import pandas as pd
from pandas.io.formats import style as pd_style
def f(s: pd_style.Styler) -> pd_style.Styler:
print(s.columns)
fmt = "{:.2%}"
return s.format(fmt)
df = pd.DataFrame({"a": [1, 2, 3]})
df2 = df.style.pipe(f)
reveal_type(df2)
- Run with mypy
mypy t.py
- error message
t.py:7: error: "Styler" has no attribute "columns" [attr-defined]
t.py:14: note: Revealed type is "pandas.io.formats.style.Styler"
Found 1 error in 1 file (checked 1 source file)
Please complete the following information:
- OS: MacOS
- OS Version Sonoma 14.4.1
- python version 3.12
- version of type checker mypy 1.14.1 (compiled: yes)
- version of installed
pandas-stubs
2.2.3.241126
Additional context
the StyleRenderer
base class has columns defined in __init__
.