Python-Redmine Unable to concat custom_field value to issues

Issue

I am unable to get the custom fields value merged on the issues. The results look like this.enter image description here

I am looking to have those lines merged together so that it would look more like
669 | 253652 | 10
671 | 118387 | 10

Here is my code that I am attempting to do this with.

results=[]
issues = redmine.issue.filter(project_id=your_project)
df =pd.DataFrame(columns = ['id','subject', 'project', 'tracker', 'status', 'priority', 'author', 'category', 'due_date', 'so','description', 'need qty'])
for issue in issues:
    results.append(issue)
for issue in results:
    df = pd.concat([df, pd.DataFrame.from_records([{'id' : issue.id,'subject' : issue.subject , 'project' : issue.project, 'tracker' : issue.tracker, 'status' : issue.status, 'priority' : issue.priority,
        'author' : issue.author, 'category' : issue.category, 'due_date' : issue.due_date, 'description' : issue.description}])], ignore_index = True)
    for custom in issue.custom_fields:
        if (custom.name == 'Need Qty'):
            df=pd.concat([df, pd.DataFrame.from_records([{'need qty' : custom.value}])], ignore_index=True)

print(df)

Solution

Is this what you are trying to accomplish?

df = pd.DataFrame({
    'Column1' : [669, 670, 671, 672],
    'Column2' : [12345, None, 67890, None],
    'Column3' : [None, 10, None, 10]
})
df['Column3'] = df['Column3'].shift(-1)
df = df.dropna()
df

Answered By – ArchAngelPwn

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published