I've read a lot of discussion about iloc vs loc and I understand the difference but what I don't understand is what's the difference between:
indexed_data['var'][0:10]
vs
indexed_data['var'].iloc[0:10]
These seem to be the same thing and give the same output.
Am I missing something? Thanks!
As a complement to the other answers, also observe the following note from the docs:
While standard Python / Numpy expressions for selecting and setting are intuitive and come in handy for interactive work, for production code, we recommend the optimized pandas data access methods,
.at
,.iat
,.loc
and.iloc
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With