Please help, this is driving me up the wall! I have watched the video walk-through and have applied the code the same but I get 4 print versions, I can see others have had the same issue but I can’t see any responses that clarify what is going on to cause this. Does it affect the rest of the project or is it just a side-affect of the print function due to the iterations in the loop? The previous step only prints one of each item.
My code is below:
daily_sales_replaced = daily_sales.replace(“;,;”, “~” )
#print(daily_sales_replaced) success!
daily_transactions = daily_sales_replaced.split(“,”)
#print(daily_transactions) worked but lots of \n
daily_transactions_split =
for item in daily_transactions:
daily_transactions_split.append(item.split(“~”))
#print(daily_transactions_split) #split with lots of whitespace.
transactions_clean =
for transaction in daily_transactions_split:
transaction_clean =
for data_point in transaction:
transaction_clean.append(data_point.replace(“\n”, “”).strip(" "))
transactions_clean.append(transaction_clean)
print(transactions_clean) #why does this print 4 iterations of each one?!?!
printscreen: