Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: background_gradient obviously has a problem with colormaps #56255

Closed
2 of 3 tasks
JB-AM opened this issue Nov 30, 2023 · 4 comments
Closed
2 of 3 tasks

BUG: background_gradient obviously has a problem with colormaps #56255

JB-AM opened this issue Nov 30, 2023 · 4 comments
Labels
Closing Candidate May be closeable, needs more eyeballs Dependencies Required and optional dependencies

Comments

@JB-AM
Copy link

JB-AM commented Nov 30, 2023

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

#code from https://github.com/pandas-dev/pandas/issues/47695 that was working then!
import itertools
import numpy as np
import pandas as pd

df_rand = pd.DataFrame(index=range(5), columns=range(5), dtype=float)

for idx1, idx2 in itertools.combinations_with_replacement(df_rand.index, 2):
    df_rand.loc[idx1, idx2] = np.random.randint(0, 100)

df_rand.style.format("{:.0f}", na_rep="").background_gradient()

Issue Description

Long message error ending with:
AttributeError: module 'matplotlib' has no attribute 'colormaps'
<pandas.io.formats.style.Styler at 0x29dc7abfa90>

Expected Behavior

Show the expected background_gradient

Installed Versions

INSTALLED VERSIONS ------------------ commit : 2a953cf python : 3.9.7.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19045 machine : AMD64 processor : Intel64 Family 6 Model 140 Stepping 1, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : fr_FR.cp1252

pandas : 2.1.3
numpy : 1.26.2
pytz : 2023.3.post1
dateutil : 2.8.2
setuptools : 57.4.0
pip : 23.3.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.4.0
pandas_datareader : None
bs4 : 4.11.1
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.4.3
numba : None
numexpr : None
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.11.4
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : 2.1.0
pyqt5 : None

@JB-AM JB-AM added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 30, 2023
@attack68
Copy link
Contributor

attack68 commented Dec 6, 2023

Have you tried with a more recent version of matplotlib (>3.4.3 from 2021)?

@JB-AM
Copy link
Author

JB-AM commented Dec 6, 2023

You’re right, with matplotlib 3.8.2, it works.
However, should the dependancy/minimum version requirement not have raised a warning at some pip install or check step?

@attack68
Copy link
Contributor

attack68 commented Dec 6, 2023

Yes that is true but managing every sinlge one of pandas dependencies for all its functions in all pandas versions is a very difficult task.

@attack68 attack68 added Closing Candidate May be closeable, needs more eyeballs Dependencies Required and optional dependencies and removed Needs Triage Issue that has not been reviewed by a pandas team member Bug labels Dec 6, 2023
@phofl
Copy link
Member

phofl commented Dec 7, 2023

Closing here

@phofl phofl closed this as completed Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closing Candidate May be closeable, needs more eyeballs Dependencies Required and optional dependencies
Projects
None yet
Development

No branches or pull requests

3 participants