Hacker News new | past | comments | ask | show | jobs | submit login

> I am so bad at iterating over dataframes! It always feels horrible and slow. While doing this though, I discovered that using df.to_dict('records') and then iterating over the resulting dictionary is almost 100x faster than using the pandas built-in iteration tools like df.itertuples() or df.iterrows()!

That's really surprising to hear, any context on why this is? Very fun read BTW, my friends and I have joked about making something similar for our DMs (nicknamed MattGPT) and giving "them" topics to discuss + observing what they come up with.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: