Top Five Tricks for Coding in Pandas — with Matt Harrison

preview_player
Показать описание
From the SDS 557: Effective Pandas — with Matt Harrison
Рекомендации по теме
Комментарии
Автор

I'm a R tidyverse user who switched to Python. I've been chaining most of my pandas expressions because that comes natural to me (as a tidyverse user). I chain it without the parenthesis, but rather use backslash to go to new line. It has pros and cons. The main pro is I can select partial code and run it in VSCode interactive similar to that in R. It's still not a replacement for R but it's close. It looks like this:

df\
.assign(value2 = lambda df_: df_['value']**2)\
.groupby('type')\
.agg(value2_sum = ('value2', 'sum'))\
.reset_index()

I can select the code upto and including the first assign, run that first, check the results, and then run the rest. In this case, it's a trivial code. But in a complex chain, this can be very helpful.

alwayz
Автор

Amazing clip. I love the idea of chainning that Matt presented. I come from R as well and it truly feels like piping.

mabenba
Автор

Amazing! My two favorite internet teachers !!

Kinnoshachi
Автор

The number on trick.. switch to R and tidyverse :)

CaribouDataScience
Автор

Intro is terrible, way too loud and the sound is annoying. Please change it.
But the conversation is great.

peeintea
Автор

Chaining isn’t that deep. So much exaggerations going on in the first half of the video. I chain when it make sense and don’t when it doesn’t matter which is basically all the time for all of data science.

jbj
Автор

Good stuff. The guest says "parenthese" for the singular form of parentheses when in fact, the correct form is parenthesis. He might have missed that point in elementary school.

richardbennett