JIRA library- getting Nan values in the list type custom fields

Nitzan Matalon May 17, 2023

Hey guys,

I'm using Jira library on python to get a pd df with the data.

I succeed to get all the fields that I want, but for some reason I get only NaN values in all of  the custom fields that thier type is list (single or multipe). These fields have values in Jira..

this is my code:

from atlassian import Jira
jira_instance = Jira(
url = ''
username =''
password = ''
)
import requests
from requests.auth import HTTPBasicAuth
import json
import pandas as pd

def retrieve_all_query_results(jira_instance: Jira, query_string: str, fields: list) -> list:
issues_per_query = 100
list_of_jira_issues = []

# Get the total issues in the results set. This is one extra request but it keeps things simple.
num_issues_in_query_result_set = jira_instance.jql(query_string, limit = 0)["total"]
print(f"Query `{query_string}` returns {num_issues_in_query_result_set} issues")

# Use floor division + 1 to calculate the number of requests needed
for query_number in range(0, (num_issues_in_query_result_set // issues_per_query) + 1):
results = jira_instance.jql(query_string, limit = issues_per_query, start = query_number * issues_per_query, fields = fields)
list_of_jira_issues.extend(results["issues"])

return list_of_jira_issues

jql_result_set_issues = retrieve_all_query_results(jira_instance, "Project in (SZ)", fields = "*all")
all_data = pd.json_normalize(jql_result_set_issues)

Does anyone know why this is happening?

Thank you

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 28, 2023

Select list fields do not hold numeric data, when you get their content via a REST call, it is giving you the name of the option as a string.

You'll need to code to convert from a string to a number.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events