Thread Shed Help

Hi guys! So I’m stuck on this thread shed exercise and the video doesn’t seem to be helping. After cleaning the list of all the whitespace and ‘\n’, I then save it to transactions_clean. printing transactions_clean gives me a list with every transaction represented for every attribute of each transaction. So I’m getting each transaction 4 times before it moves on to the next one. I’ll include 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(' '))


I am not sure how to fix it and the video implies I’m doing everything correctly.


Consider your indentation in your inner for-loop. It’s very close to being correct.

This problem actually inspired me to write a post 2 days ago (since 2 people had the same exact problem following the video that day… but this is a very common problem that has happened many times to people): Making the most of video tutorials… feel free to leave thoughts there as well!

1 Like

That worked! Thank you so much! I’m grateful I actually understand what I did wrong and will look for it next time. I appreciate the article as well! It’s good to remember going into those projects.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.