Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
218 views
in Technique[技术] by (71.8m points)

python 3.x - is it possible to save dataframe to atlassian page using api?

How to save pandas dataframe directly to Atlassian confluence page using API in python? I used atlassian-python-api library. but didn't get any solution.

question from:https://stackoverflow.com/questions/65892299/is-it-possible-to-save-dataframe-to-atlassian-page-using-api

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In the future, please review how to ask questions that are MCVE so that others can help you more easily.

If you are using the altassian python api, you should be able to do this relatively easily

from the documentation for the confluence module, running the confluence.create_page command will create a page in your given workspace.

confluence.create_page(space, title, body, parent_id=None, type='page', representation='storage', editor='v2')

In your case, if you want to create the pandas dataframe as a table in confluence, you should use the DataFrmae.to_markdown command introduced in pandas version 1.0.0.

From the docs, the command will generate markdown which you can see below.

s = pd.Series(["elk", "pig", "dog", "quetzal"], name="animal")
print(s.to_markdown())


|    | animal   |
|---:|:---------|
|  0 | elk      |
|  1 | pig      |
|  2 | dog      |
|  3 | quetzal  |

Which will yield markdown as such.

animal
0 elk
1 pig
2 dog
3 quetzal

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...