Search code examples
pythonpandasjira

Convert output to a Pandas dataframe


I have the below data from JIRA. I am trying to have this converted into a pandas Dataframe.

Here is my code:

from jira import JIRA

jiraOptions = {'server': 'https://**********.atlassian.net'}

jira = JIRA(options=jiraOptions, basic_auth=(
    '*******@gmail.com', '******************'))

project = 'project = GDI'

lista = []

for issue in jira.search_issues(jql_str=project):
        print('{} | {} | {} | {} {} | {} | {} | {} | {} | {} |'.format(issue.key,
                                                                    issue.fields.project.name,
                                                                    issue.fields.summary,
                                                                    issue.fields.issuetype,
                                                                    issue.fields.status,
                                                                    issue.fields.priority,
                                                                    issue.fields.reporter.displayName,
                                                                    issue.fields.created,
                                                                    issue.fields.assignee,                                     
                                                                    issue.fields.description,))

Expected output :

issue key:      Project name:       summary:               issue type:     assignee:
GDI-6           PROJECTBLABLA       Summaryblabla          epictodo        Nova
GDI-5           PROJECTBLABLA       Summaryblabla          epictodo        Nova
GDI-4           PROJECTBLABLA       Summaryblabla          epictodo        Nova
GDI-3           PROJECTBLABLA       Summaryblabla          epictodo        Nova

Is there a smart way to do it? I'm really stuck.. All what I know is that I need a list for that, right? So I need to put every details into their corresponding list, instead of printing them, then I work on pandas.

Thanks in advance,

Nova


Solution

  • After hours and hours.. I found out the all I had to do is adding .name after issues fields, like that:

    issue.fields.summary,
    issue.fields.issuetype.name,
    issue.fields.status.name,
    issue.fields.priority.name,
    issue.fields.reporter.displayName,
    issue.fields.created,
    issue.fields.assignee.displayName,                                     
    

    Thanks for your efforts for trying to help.