-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
table_conversion='matplotlib' and set_table_styles #106
Labels
Comments
Confirmed, dealing. |
I have a similar issue, the effect of style.bar is not showing up in the image. df_fmt = df.style.bar(subset=['Prob(%)'], color=["green","red"], align="zero") |
Created pull request to fix the issue.: #123 examples that this was tested with... col_headers = {
"selector": ".col_heading, thead",
"props": "color: white; background-color: #1d5632; \
font-size: 11px"
}
col_data = {
"selector": ".data",
"props": "color: black; background-color: #f4f4f4; \
font-size: 11px"
}
x,y,z = npy.random.random((3,3))
df = pd.DataFrame({
"x":x[0:],
"y":y[0:],
"z":z[0:]
})
styled_df = df.style.set_table_styles([col_headers, col_data])
dfi.export(styled_df, "df_style.png", table_conversion="matplotlib")
output = {
'Metric': ['P50_FPS', 'Batt_Drop(PM)', 'Temp_Inc(PM)'],
'Low': [19.58858, 0.47901234567901235, 0.2906172839506173],
'Mid': [29.933165, 0.3128301033724491, 0.22643293121519142],
'High': [29.924354, 0.36855614395331243, 0.2592294391008322],
'Ultra': [44.800098500000004, 0.3901357466063348, 0.3003981900452488]
}
df = pd.DataFrame(output)
df = df.apply(lambda x: round(x, 2))
styled_df = df.style.format(precision=2).hide(axis='index')
styled_df.set_caption("Hello World")
styled_df.set_properties(subset=["Low", "High"], **{'font-size': '14pt', 'width':'40px', 'background-color':'lightblue', 'padding':'10px', 'text-align':'center'})
styled_df.set_properties(subset=["Mid", "Ultra"], **{'color': 'red', 'width':'40px', 'background-color':'lightyellow', 'padding':'10px', 'text-align':'center'})
dfi.export(styled_df, "df_style_1.png", table_conversion="matplotlib") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I created a table with a style and I tried to export in png with the conversion = 'matplotlib'. Unfortunately, I do not see the style in my png.
Thank you for your help.
Here is my code:
Exported png:
df_styled in Jupyter:
The text was updated successfully, but these errors were encountered: