Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,552,206
Community Members
 
Community Events
184
Community Groups

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

Edited

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