SECRET OF CSS

Plotting Story Points from Jira with Python | by Lucas Soares | Jun, 2022


Exporting and visualizing your data from Jira using Python

0*VHIiRvTBN4u11F5q
Photo by Isaac Smith on Unsplash

My current company uses a scrum system and the Jira software, which means keeping track of story points, issues, epics, and more. Although Jira provides a tone of features for visualizing your data, I wanted to see if I could plot my story points along different epics. So, I decided to use Python to do some basic data analysis.

In this article, I will show you how to plot data from your Jira dashboard using Python

The basic steps for this are:

  1. Export the data from Jira
  2. Load the data
  3. Clean and prepare the data
  4. Visualize the data

Let’s get to work!

1. Export the data from Jira

The steps to export your data from Jira are:

  1. Go to Reports
1*pyN9KCkH1Zn0kASPPiQT7Q
Image by the author, screenshot from jira.com

2. Go to sprint report

Image by the author, screenshot from jira.com

3. Go to see navigator issue in the right corner of the sprint dashboard

1* EaWUUwPzvROQY awtDpwg
Image by the author, screenshot from jira.com

4. Click in all issues

1*BulO4UGm7h06uiwSl73XIA
Image by the author, screenshot from jira.com

5. Click in export

Image by the author, screenshot from jira.com

6. Export to CSV

1*F9bMbfwVZdk5c0H90c8T6g
Image by the author, screenshot from jira.com

Load the Data

Ok, now for the fun part, let’s load the data using Python. For privacy reasons, I changed the data and removed restricted information.

import pandas as pd

df = pd.read_csv("./jira_data.csv")

Clean and prepare the data

To clean up the data we will just select the relevant columns we will need, drop nans and irrelevant data, and finally, validate that the final dataframe looks good.

The columns we will need from the CSV are:

  • Assignee: the person responsible for the task (in this case me!)
  • Sprint: the name of the sprint (in this case in letters alphabetical order)
  • Custom field (Story Points): the story points for each task (here I am not sure if this field will have a different name, but just look for something like story points)
df = df[["Assignee", "Sprint", "Custom field (Story Points)"]].reset_index(drop=True)

# drop nans from dataframe
df = df.dropna()

Now I group columns by the sprint name:

# letters from A to J in upper case as a list
cols = list(map(chr, range(65, 75)))

cols

for col in df["Sprint"].unique():
if col not in cols:
df.drop(df[df["Sprint"] == col].index, inplace=True)

df["Sprint"].unique()

array(['J', 'I', 'H', 'G', 'F', 'E', 'D', 'C', 'B', 'A'], dtype=object)df_sorted_points = df.groupby(["Sprint"])["Custom field (Story Points)"].sum().reset_index()
df_sorted_points
1* k1f0I0frE
Image by the author

Perfect! Now that we have our data we can start working on visualizing it!

Visualize the Data

What I want from this example is just an organized timeline of my story points per sprint in order.

import matplotlib.pyplot as plt
import seaborn as sns
sns.set()

colors = sns.color_palette("hls", len(df_sorted_points["Sprint"].unique()))

plt.title("Story Points per Sprint")
plt.bar(df_sorted_points["Sprint"],
height=df_sorted_points["Custom field (Story Points)"],
color=colors);

1*dLR Pmkwp1257CGmGiUrFA
Image by the author

There is a lot one could do with Jira data to improve productivity, in this case, my focus was mostly on having information regarding the coherence of my sprint planning.

In the future, I might look at things like the interaction between the number of story points and time spent on tasks.



News Credit

%d bloggers like this: