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

Well thats the thing with pandas, which one is it? [], loc, iloc, . ? Why do I have to reset_index so often? I agree with OP R has Pandas beaten when it comes to accessing data.



I will agree about [] being overloaded, but .loc and .iloc are distinct for a good reason. .loc is for operations according to the index, .iloc is for operations according to position. You have to reset_index() so often probably because you are not using the index properly. Effective use of Pandas means effective use and consideration of the indexes on your dataframes and series.

Recommended watching (32:00 onwards): https://www.youtube.com/watch?v=mWtfZaT7iSc


iloc - numerical location, loc - location in table

I rarely reset index -- perhaps its a difference in familiarity? (I use R but it isn't my background, perhaps there is a forced R pattern that is a general antipattern for indexes?)




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

Search: