Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Data Science Basics Cleaning Data Clean Up Your Data

Issues with csv or code in the "Cleaning Up Your Data" video!

Whenever I run my code, I get that length is equal to 5051 and not 56.

Someone else on the forums mentioned that they have a column titled "Cashmere", however, I do not have this on my csv data file, so I am unsure if it's an issue with my code or the data file.

My code (as a side note - because I've had issues with workspaces, I'm running my code on my computer):

from s2v5 import *

def create_bool_field_from_search_term(data_sample, search_term): new_array = [] new_array.append(data_sample[0].append(search_term))

for row in data_sample[1:]:
    new_bool_field = False
    if search_term in row[9]:
        new_bool_field = True

    row.append(new_bool_field)
    new_array.append(row)

return new_array

def filter_col_by_bool(data_sample, col): matches_search_term = []

for item in data_sample[1:]:
    if item[col]:
        matches_search_term.append(item)

return matches_search_term

my_new_csv = create_bool_field_from_search_term(data_from_csv, "cashmere") number_of_cashmere_ties = number_of_records(filter_col_by_bool(my_new_csv, 11)) print("Length:", number_of_cashmere_ties)

Not sure why my code is formatted like that.

My header row for my data file includes: 'id', 'priceLabel', 'name', 'brandId', 'brandName', 'imageLink', 'desc', 'vendor', 'patterned', 'material'

I'm working on a Windows 10 computer. Could it be conversion issues from Mac to Windows?