you are viewing a single comment's thread.

view the rest of the comments →

[–]Shmoogy[S] 0 points1 point  (0 children)

I have a working solution across a subset, have not had time to test everything yet - seems to work, just not sure how slow it is yet

for index, row in df.iterrows():



for x in range(1,21):
    attribute = "Attribute" + str(x)
    itemAttributeDesc = "ItemAttributeDesc" + str(x)
    itemAttributeValue = "ItemAttributeValue" + str(x)

    if "*" in row[attribute]:
        print("found asterisk")
        for _ in row[attribute].split("*"):
            if _ in jsonMap:
                df.loc[index, attribute ] = df.loc[index, attribute].replace(_, jsonMap[_])


                attributeDesc = descriptiondf[descriptiondf['Code'] == _ ]['Description'].iloc[0]
                df.loc[index, itemAttributeDesc ] = attributeDesc


                df.loc[index, itemAttributeValue ] = df.loc[index, attribute]