dexplo/dataframe_image

when argument table_conversion = 'matplotlib' of export functions,the dataframe's set_caption will not work.

Closed this issue · 5 comments

when I run below code on my macbook,everything is Ok;

    helper = WxMsgHelper()
    current_date = datetime.datetime.now().strftime('%Y-%m-%d')
    for user_name in user_tables_map:
        df1 = df[df.createby.str.contains(fr'\b{user_name}\b', regex=True, case=False)]
        if len(df1) > 10:
            df_styled = df1.style.background_gradient() 
            df_styled = df_styled.set_caption('<b>time:{}<br>'.format(current_date))
            dfi.export(df_styled,"{}.png".format(user_name),max_rows=-1)
            helper.send_wx_image('zds', "{}.png".format(user_name))
        break

when I run below code on my macbook, the caption of table lost.

    helper = WxMsgHelper()
    current_date = datetime.datetime.now().strftime('%Y-%m-%d')
    for user_name in user_tables_map:
        df1 = df[df.createby.str.contains(fr'\b{user_name}\b', regex=True, case=False)]
        if len(df1) > 10:
            df_styled = df1.style.background_gradient() 
            df_styled = df_styled.set_caption('<b>time:{}<br>'.format(current_date))
            dfi.export(df_styled,"{}.png".format(user_name),max_rows=-1,,table_conversion = 'matplotlib')
            helper.send_wx_image('zds', "{}.png".format(user_name))
        break

Does anyone know how to set_caption when I set table_conversion = 'matplotlib'.

Is this resolved? I am facing similar issue

muupan commented

I am facing the same issue. table_conversion="chrome" works with set_caption but matplotlib does not.

matplotlib is a simulation method. We actually create rectangle as cells and then combine them together.

So if set_caption need to work, it will take a lot of effort to simulate that.

This feature is planned but will not release soon.

BTW, if anyone can provide a PR would be very helpful.

Supported by 45fda8d

Will release soon