Pandas is such a unique learning experience. It's the only tool where my mental model changes substantively every time I use it. Yet, I find Pandas hard to "properly" learn because all the tutorials are boring stock market examples.
-
-
Like today, I wanted to filter outliers within a group defined by two columns. Found an SO post about doing this within a single-column group. It used a novel mechanism (broadcasting between dataframes of different sizes) and I kept failing to transfer the example to my task.
Show this thread -
Maybe Pandas is just overly complex. I liked
@yifanwu's example of 8 different ways to filter a dataframe.pic.twitter.com/J3xLfiVHeG
Show this thread -
But at the same time, for the parts of the programming model that I do understand, I feel really productive. It's like a beautiful mix of SQL and jq. I never have to use a for-loop, and I rarely even need a higher-order function.
Show this thread
End of conversation
New conversation -
-
-
out if curiosity, have you tried taking the tasks you do with for loop and iterrows and tried to translate them into something more "pandas native"?
-
My knee jerk is that you probably want to break up operations instead of doing them all at once. like, maybe you're using a for loop to accumulate into variables, but you could make new columns and then aggregate them; something like that
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
cognitive psychology. PhD