I am trying to update a dataframe row based on a list of tuples. The tuple will contain a colum name (stage name) and value for stage depending on if it passed or not.
example:
Stage 1 SUCCESS
stage 2 SUCCESS
stage 3 SUCCESS
stage 4 DELAYED
stage 5 PENDING
I generated a empty data frame and populated the colum names and the stage names like so ...
df = df.append({'project_name' : current_project}, ignore_index=True)
project_name Stage 1 Stage 2 Stage 3 Stage 4 Stage 5
0 [project 1] NaN NaN NaN NaN NaN
However, I can't seem to update the colum correctly by extracting the tuple and using a condition to update the row. No matter what I try...
for details in stage_data:
(item, item_status) = details
#print(item, item_status)
df.loc[df.project_name == current_project, item] = item_status
print(df)
the result is alway the same:
project_name Stage 1 Stage 2 Stage 3 Stage 4 Stage 5
0 [project 1] NaN NaN NaN NaN NaN
Can someone tell me what I am missing?
Thanks,
E