dataframe_image icon indicating copy to clipboard operation
dataframe_image copied to clipboard

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

Open dawsongzhao opened this issue 2 years ago • 3 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'.

dawsongzhao avatar Dec 03 '22 01:12 dawsongzhao

Is this resolved? I am facing similar issue

hengkokchin avatar Jul 11 '23 06:07 hengkokchin

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

muupan avatar Aug 01 '23 07:08 muupan

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.

PaleNeutron avatar Aug 29 '23 02:08 PaleNeutron

Supported by https://github.com/dexplo/dataframe_image/commit/45fda8db7e18de806b3743aa9dd7ddb5b300fff9

Will release soon

PaleNeutron avatar Jul 16 '24 09:07 PaleNeutron

Released: https://github.com/dexplo/dataframe_image/releases/tag/v0.2.4

PaleNeutron avatar Jul 17 '24 10:07 PaleNeutron