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

AttributeError: 'Styler' object has no attribute 'render' #252

Open
MonkeyKingz opened this issue Jul 31, 2023 · 0 comments
Open

AttributeError: 'Styler' object has no attribute 'render' #252

MonkeyKingz opened this issue Jul 31, 2023 · 0 comments

Comments

@MonkeyKingz
Copy link

Hello, im having the issue with dataframe_image 0.1.1 (suing spyder) and what i want is export a table with styles to a .png file and it was working before updating anaconda.

Resume of code:
#function to apply the styles, etc...
def format_table(dist_conj_freq_hmtp, legendas_APDL, first_semestre_year_QC, last_semestre_year_QC , first_semestre_month_QC, last_semestre_month_QC):
if first_semestre_month_QC == last_semestre_month_QC:
return (dist_conj_freq_hmtp.style
.applymap(where)
# .set_precision(1)
.set_caption('ADCP - '+legendas_APDL[:5]+' - '+meses[first_semestre_month_QC]+' de '+str(first_semestre_year_QC))
.set_table_styles([
{'selector': 'th.col_heading', 'props': 'text-align: center;'},
{'selector': 'caption', 'props': 'font-size: 200%;'},
{'selector': '', 'props': 'border: 1px solid black'},
{'selector': 'td', 'props': 'font-size: 1.5em;'},
{'selector': 'th', 'props': 'font-size: 1.5em;'},
{'selector': 'th:nth-child(1)','props': [('border-right', '1px solid black')]}, #border no index
{'selector': 'th:nth-child(1)','props': [('border-top', '1px solid black')]}, #border no index da coluna 0
{'selector': 'th:last-child', 'props': [('border-left', '1px solid black')]}, # border no cabeçalho ultima
{'selector': 'tr:last-child td', 'props': [('border-top', '1px solid black')]}, # border na ultima linha
{'selector': 'tr td:last-child', 'props': [('border-left', '1px solid black')]}, #colunas e linhas
{'selector': 'th.col_heading.level0', 'props': 'font-size: 1.55em;'},
{'selector': 'td', 'props': 'text-align: center; font-weight: bold;'}])
)
and then dfi.export(dist_conj_freq_hmtp[i],'dist_conj_freq_mensal_hmtp_'+legendas_APDL[:5]+''+month_name[i]+''+str(ano[i])+'.png',fontsize=3.8, table_conversion='chrome', chrome_path=None)

The result i get is:

File ~\Anaconda3\lib\site-packages\dataframe_image_pandas_accessor.py:24 in export
return _export(obj, filename, fontsize, max_rows, max_cols, table_conversion, chrome_path)

File ~\Anaconda3\lib\site-packages\dataframe_image_pandas_accessor.py:69 in _export
html = '

' + obj.render() + '
'

AttributeError: 'Styler' object has no attribute 'render'

Can someone help me out? Using pandas 2.0.3

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

No branches or pull requests

1 participant