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

Pandas background gradient (heatmap) #194

Closed
matinnuhamunada opened this issue Sep 25, 2023 · 2 comments · Fixed by #196
Closed

Pandas background gradient (heatmap) #194

matinnuhamunada opened this issue Sep 25, 2023 · 2 comments · Fixed by #196

Comments

@matinnuhamunada
Copy link

Hi, is it possible to convert the heatmap view from pandas in itables?

import pandas as pd
import seaborn as sns

cm = sns.light_palette("green", as_cmap=True)

# Create a sample DataFrame
data = {
    'A': [1, 3, 5, 7],
    'B': [2, 4, 6, 8],
    'C': [3, 6, 9, 12]
}

df = pd.DataFrame(data)

# Apply heatmap styling
styled_df = df.style.background_gradient(cmap=cm)
styled_df
@mwouts
Copy link
Owner

mwouts commented Sep 28, 2023

Hi @matinnuhamunada , nice question, thanks. At some point I would like to provide support for Pandas' style, but at the moment there is nothing like this.

If you feel like coding this in JavaScript this is the only current option. You could start from this example: https://mwouts.github.io/itables/advanced_parameters.html#advanced-cell-formatting-with-js-callbacks

Please let this issue open, I might use to to report on progress re the support for style.

Kind regards

@mwouts
Copy link
Owner

mwouts commented Sep 28, 2023

Hi @matinnuhamunada , actually I think I can support this too. I have prepared a PR #196 .

Would you mind giving a try at the development version? You can get it with

pip install git+https://github.com/mwouts/itables.git@support_style

Let me know how it goes for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants