How to get list of empty values as well as the found data in a dataframe?

Viewed 33

The dataframe det_proj_gle_df contains 250 lines and only about 20 items return in a list. I would like it so that all 250 return in the list but the ones with no data will add a "NA" to the list instead. Thanks.

det_proj_gle_df = pd.DataFrame(list_detail_proj_gle)
str_1 = det_proj_gle_df["custom_fields"]

i = 0
pillar = []
for i in range(len(det_proj_gle_df)):
    for line in str(str_1[i]).split('{'):
        if "Program Pillar" in line:  
            line = line.split(':')
            line = line[4]
            line = line.split(',')
            line = line[0]
            line = line.replace("\'","")
            pillar.append(line)
        else:
            pillar.append("NA")
       

pillar
0 Answers
Related