Skip to content

Unable to map background gradient from numeric column entry to entire row #28901

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

Closed
IPGreene opened this issue Oct 10, 2019 · 1 comment · Fixed by #39930
Closed

Unable to map background gradient from numeric column entry to entire row #28901

IPGreene opened this issue Oct 10, 2019 · 1 comment · Fixed by #39930
Labels
Styler conditional formatting using DataFrame.style Visualization plotting
Milestone

Comments

@IPGreene
Copy link

import pandas as pd
import seaborn as sns
data = [['thing', 'T01', 0], ['thing2', 'T02', 5], ['thing3', 'T03', 25], ['thing', 'T01', 2]]
df = pd.DataFrame(data, columns=['Access', 'Access ID', 'Freq'])
cm = sns.light_palette("green", as_cmap=True)
df.style.set_caption('Access').background_gradient(cmap=cm, axis=0)

Currently I'm only able to apply background gradient to the 'freq' column however it would be ideal if it would colour the entire row.

Note: We receive a lot of issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates!

Note: Many problems can be resolved by simply upgrading pandas to the latest version. Before submitting, please check if that solution works for you. If possible, you may want to check if master addresses this issue, but that is not necessary.

For documentation-related issues, you can check the latest versions of the docs on master here:

https://pandas-docs.github.io/pandas-docs-travis/

If the issue has not been resolved there, go ahead and file it in the issue tracker.

Expected Output

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]
INSTALLED VERSIONS

commit: None
python: 3.7.3.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 142 Stepping 10, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.24.2
pytest: 4.3.1
pip: 19.0.3
setuptools: 40.8.0
Cython: 0.29.6
numpy: 1.16.2
scipy: 1.2.1
pyarrow: None
xarray: None
IPython: 7.4.0
sphinx: 1.8.5
patsy: 0.5.1
dateutil: 2.8.0
pytz: 2018.9
blosc: None
bottleneck: 1.2.1
tables: 3.5.1
numexpr: 2.6.9
feather: None
matplotlib: 3.0.3
openpyxl: 2.6.1
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: 1.1.5
lxml.etree: 4.3.2
bs4: 4.7.1
html5lib: 1.0.1
sqlalchemy: 1.3.1
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None

@jbrockmendel jbrockmendel added the Visualization plotting label Dec 18, 2019
@attack68 attack68 added the Styler conditional formatting using DataFrame.style label Feb 20, 2021
@attack68
Copy link
Contributor

duplicate of #22727

@jreback jreback added this to the 1.3 milestone Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Styler conditional formatting using DataFrame.style Visualization plotting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants