Skip to content

Consider removing apply and lambda completely #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
joelostblom opened this issue Jan 5, 2023 · 0 comments · Fixed by #301
Closed

Consider removing apply and lambda completely #100

joelostblom opened this issue Jan 5, 2023 · 0 comments · Fixed by #301

Comments

@joelostblom
Copy link
Contributor

joelostblom commented Jan 5, 2023

Copied from slack:

What do you think of not teaching apply and lambda at all? It might sound radical at first, but I don't think we need to use these anywhere in dsci 100. The examples we have there right now are better done in other ways, and after spending the last hour trying to come up with better examples, I think all use cases where apply and lambda are justified are too advanced for dsci 100 (and honestly maybe also for MDS based on how I see students often use it). This would cut down the material and reduce complexity at seemingly no/little cost from what I can tell. I can make a PR of what this would look like in all the chapters (we rarely use them already so there would not be that many changes), unless you think it is too preposterous of a suggestion =)

Trevor mentioned this is not the most important thing to do right now so I will hold off with it.


Edit: Also note that the way we suggest to use apply makes the syntax more complicated. E.g

region_lang.loc[:, "mother_tongue":"lang_known"].apply(lambda col: col.astype("int32"))

instead of just

region_lang.loc[:, "mother_tongue":"lang_known"].astype("int32")

and apply(max, axis=1 instead of .max(axis='index')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant