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 Filtering Rows

KAZUYA NAKAJIMA
KAZUYA NAKAJIMA
8,851 Points

"<" should be used?

In video teacher kat uses <= for direction of filter_col_by_float, but < would better to be used for function argument and number of ties < $20 will be 28, not 38.

in video:

under_20_bucks = filter_col_by_float(data_from_csv, "priceLabel", "<=", 20)
print("Found {} ties < $20".format(number_of_records(under_20_bucks)))

should be?:

under_20_bucks = filter_col_by_float(data_from_csv, "priceLabel", "<", 20)
print("Found {} ties < $20".format(number_of_records(under_20_bucks)))

Mathematically you are correct. This may however, just be one of those "do as I do, not as I say" situations.

KAZUYA NAKAJIMA
KAZUYA NAKAJIMA
8,851 Points

Thank you, noted what you are indicating.

3 Answers

Kat Chuang
STAFF
Kat Chuang
Treehouse Guest Teacher

Hi @kazuyanakajima, you are correct about using < for mathematical precision.

In this example I included the ties that are priced at $20 in the sample and it is a personal preference because in the region and context of my work, we usually round up to the nearest 10. Like you brought up, it is better to explain whether < or <= was used in calculations.

Filter all the DKNY branded ties from the data_from_csv variable into a variable named dkny_ties, using the function filter_col_by_string(). Hint: the field to filter on is called "brandName". guys anyone with the idea to this question

KAZUYA NAKAJIMA
KAZUYA NAKAJIMA
8,851 Points

Teacher kat: well noted with thanks!