[Python] Converting pandas dataframe to wiki markup table

Discussão em 'Python' iniciado por Stack, Setembro 24, 2024.

  1. Stack

    Stack Membro Participativo

    I'm automating some data processing and creating jira tickets out of it. Pandas does have to_html or to_csv or even to_markdown. But jira supports only wiki markup for creating a table.

    e.g.

    <!-- wiki markup -->
    ||header1||header2||header3||\r\n|cell 11|cell 12|cell 13|\r\n|cell 21|cell 22|cell 23|


    will create

    header1 header2 header3
    cell 11 cell 12 cell 13
    cell 21 cell 22 cell 23

    Is there anyway to convert pandas dataframe to wiki markup table to be used in Jira?

    I'm keeping df.iterrows as Last resort since iterating over dataframe is not a recommended solution as per answers in How can I iterate over rows in a Pandas DataFrame? Since my expected dataframe is small, iteration should be fine in my case. This question can be considered as more of a curiosity what can be done in case of larger dataframes.

    Continue reading...

Compartilhe esta Página