Skip to content

Instantly share code, notes, and snippets.

@kokumura
Created August 22, 2017 06:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
PandasのDataFrameをJIRAのテーブル(Wikiマークアップ)文字列に変換
import pandas as pd
def dataframe_to_wikitable(df):
lines = []
columns = df.columns.values
lines.append('|| ' + ' || '.join(columns) + ' ||')
for ix, row in df.iterrows():
line = '| ' + ' | '.join(str(row[col]) for col in columns) + ' |'
lines.append(line)
return '\n'.join(lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment