Indexing is used to access values present in the Dataframe using “loc” and “iloc” functions.In Numpy arrays, we are familiar with the concepts of indexing, slicing, and masking, etc. Similarly, Pandas to supports indexing in their Dataframe. If we are familiar with the indexing in Numpy arrays, the indexing in Pandas will be very easy.
Why iloc and loc are preferred for indexing and slicing in pandas ? It may be confusing at first but trust me , you will understand it :)
A beginner’s guide to selecting subsets of data from a Pandas dataframe.