Closed tisonkun closed 1 year ago
I just found a way now:
c = obtain_client()
prs = c.paginate(
c.rest.pulls.list,
owner="apache",
repo="pulsar",
state="open")
df = pd.DataFrame([vars(pr) for pr in prs])
But I still wonder if we can provide some utilities to interoperate with pandas smoothly.
githubkit
uses pydantic model to serialize data. You can search for the way to convert pydantic models into pandas DataFrame. In the code above, you may change the vars(pr)
into pr.dict()
. More infomation about the usage, you can check the pydantic docs
@yanyongyu Thank you!
Said I fetch the pulls as:
Now
prs
is a generator ofPullRequestSimple
list. How can I convert it to a pandas DataFrame as: