Notebook correction

Course Name: Python for Trading: Basic, Section No: 8, Unit No: 19, Unit type: Notebook

in filteration

print(mp.groupby('MarketCap').filter(lambda x: len(x) >= 3))

What does this mean?

It will filter out the Groups that have less than 3 companies in that particular group.

is not correct, it will filter out the groups that have 3 companies or more in that particular group

Hi Sebastian,



The filter() function will filter out (i.e., remove) the groups that do not satisfy the condition represented by the lamda function.

So, the code is essentially filtering out (removing) the groups that have less than three elements, and only the groups that meet the condition will be included in the output.



Thanks.