Where is this code taught to us?

Screen Link:Learn data science with Python and R projects

stratum_G = wnba[wnba.Pos == ‘G’]

2 Likes

This is called boolean indexing. You can find it on previous mission of Exploring Data with pandas: Fundamentals

https://app.dataquest.io/m/381/exploring-data-with-pandas%3A-fundamentals/9/using-boolean-indexing-with-pandas-objects

1 Like

Hey,
I have seen the mission. However, we have used wnba[“Pos”] rather than wnba.Pos anywhere. Things are missing sir.

2 Likes

Hi @keswani06,

You can find the answer here: 2nd page of the Takeaways - “Resources” - “Indexing and Selecting Data”. In the opened documentation page, you need Attribute access.

However, using wnba['Pos'] (or df['column_name'] in general) is a more common approach. To use directly df.column_name, the column name has to satisfy some requirements (not to contain white spaces, dashes, and some others restrictions). Probably it’s better to always use this syntax df['column_name'], just to avoid any confusion.

3 Likes

Hey Elena,

Please make the curriculum more coherent as there might be some confusion and anxiety among beginners.

1 Like

Hi @keswani06,

Sorry about that; we initially had mentioned this alternative syntax in our pandas course; perhaps we missed it during the course rewrite. That said, I appreciate your feedback on it, and I agree with you. I will inform the content team to work on it during the next course optimization.

1 Like