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
AttributeError: 'ColormapRegistry' object has no attribute 'get_cmap' #74
Comments
I think it is not a problem related to dfi. Try replace the last line with:
And see if the same error occors. |
Hi! import pandas as pd
import dataframe_image as dfi
aa_dict = {"A":{"a1":1,"a2":2},"B":{"a1":3,"a2":4}}
df = pd.DataFrame.from_dict(aa_dict)
df_styled = df.style.background_gradient(axis=None)
dfi.export(df_styled.to_html(),"df_experiment.png",dpi=600) And the error is the same Thanks! |
I mean to html without dfi. I think this error is not related to this module. import pandas as pd
aa_dict = {"A":{"a1":1,"a2":2},"B":{"a1":3,"a2":4}}
df = pd.DataFrame.from_dict(aa_dict)
df_styled = df.style.background_gradient(axis=None)
df_styled.to_html() |
Oh, ok, yes sorry for the confusion. I did it correctly now and get the same error, indeed. Is it a Thanks! |
I never heard a problem about this, maybe you need to confirm your env first. |
Ok, just to confirm, do you want to check the "environment" as in all the installed packages? Or else? |
I have the same problem with this code:
|
Have you solved this problem? |
Have you solved this problem? |
@huo-shan-long At that time I simply just solved it by "not using the background_gradient styler". I need this functionality again, so I will see if things have changed. I have upgraded Working on a work-around |
@huo-shan-long @On-ryo @PaleNeutron Ok. I found a work-around. If you manually modify the function Like this:
There seems to be a bug on some matplotlib compatibility. I used the ugly try-except combo because I am not sure if the condition if |
I solved the problem, the pandas version at the beginning was 2.0.2, after I downgraded version it to 1.5.3, it worked. |
@huo-shan-long yeah, it is a version problem, but if you do not want to downgrade, the previous works |
Congratulations! Is there any thing I should modify in |
@PaleNeutron Hmm, perhaps recommend a lower version of pandas? like a warning?, I would not enforce a downgrade. |
@LysSanzMoreta I had the same error under |
I am having this same problem right now. |
A simple way to solve this problem without editing libraries is just to set "image.cmap" of your choice:
and when call 'background_gradient':
|
@LysSanzMoreta , sorry not to mention you above! You are right that the problem cause is versioning. But it is the better way to solve the problem in your code, not in the library #74 (comment). |
Whops, I cannot use the background_gradient styler while also exporting because I get the following error:
Packages versions:
Code to reproduce error:
Error:
Side note: i can export if I do not use the background_gradient styler
Thanks!!!
The text was updated successfully, but these errors were encountered: