Thread Shed

I am currently working on the Thread Shed Python project. Although I have watched the walkthrough and copied it into my own after hitting a dead end i still wasn’t able to get the correct results.
Here is my code below:

daily_sales_replaced = daily_sales.replace(“;,;”, “+”)
daily_transactions = daily_sales_replaced.split(“,”)

daily_transactions_split =
for transaction in daily_transactions:

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 should come back a nice list, however it always returns with several duplicates of each Item.
Can someone please let me know what I am not seeing.

1 Like

I understand the frustration. This issue comes up a lot b/c the video isn’t very clear (known issue (been reported) for years, just search this project here in the forums and you can see via everyone’s replies).
That said, I’m pretty sure you have an indentation error in one of your for loops. But, it’s difficult to tell when the code isn’t formatted. Remember: Python relies on indentation.

Please remember to do the following when posting:

And, you might try searching for previous answers in posts about this project (as there are ~50+ posts).
See this guide for help:

1 Like

I ran into the same issue, it was printing 4 of each txs group of 4. The issue comes from appending transaction_clean to transactions_clean in the second for loop. Backspace that line, out of the 2nd for loop but still in the first for loop, and that will fix the issue. Like so, it might be hard to tell but i’ve used | and a space to accommodate the indentation in the for loop:
|for d_point in txs:
| transaction_clean.append(d_point.strip(’ '))

1 Like