Skip to content

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

Description

@MonkeyKingz

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions