You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
importpandasaspdimportnumpyasnp# Dummy dataframedf=pd.DataFrame(np.random.rand(15).reshape(5,3), columns='x y z'.split())
# Apply style with `set_table_styles` and `applymap`style=df.style \
.set_table_styles([{'selector': 'th', 'props': [('background-color', 'orange')]}]) \
.applymap(lambdax: 'color: red'ifx>.5else'color: blue')
# Test with different enginesforengin ('xlsxwriter', 'openpyxl'):
style.to_excel(f'tbl_style_tst_{eng}.xlsx', engine=eng)
Problem description
In both xlsx files output above, only the element styling (applymap) are observed. Any set_table_styles styling seems to be ignored regardless of engine. The html from style.render() confirms the styling is correct, and is observed in html output as well:
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
In both
xlsx
files output above, only the element styling (applymap
) are observed. Anyset_table_styles
styling seems to be ignored regardless of engine. The html fromstyle.render()
confirms the styling is correct, and is observed in html output as well:Expected Output
Unable to show excel/colors here, but the columns/index should have colour styling applied as expected from
set_table_styles
.Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.4.final.0
python-bits : 32
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_Canada.1252
pandas : 1.0.3
numpy : 1.18.4
pytz : 2020.1
dateutil : 2.8.1
pip : 19.2.3
setuptools : 40.8.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 1.2.8
lxml.etree : 4.5.0
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.5.0
matplotlib : None
numexpr : None
odfpy : None
openpyxl : 3.0.0
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : 1.2.8
numba : None
The text was updated successfully, but these errors were encountered: