Skip to content

Instantly share code, notes, and snippets.

@kokumura
Created August 22, 2017 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kokumura/e92e66539fee5eaf52e7bb51e7bf0179 to your computer and use it in GitHub Desktop.
Save kokumura/e92e66539fee5eaf52e7bb51e7bf0179 to your computer and use it in GitHub Desktop.
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