How do I read certain rows in Excel using pandas Python?

How do I read specific columns and rows in Excel pandas?

This question is in reference to the Python pandas library. How can I read specific columns and rows of a dataframe without having to read all of it into memory? What I'm asking specifically is what are the different ways you read data in pandas and which ones are the most efficient?DataFrame(dataframe) Now if I were to want to read in only the column A and row 3, how would I do that? A B C D. 0 0 0. 1 0 0. 2 1 1. I've seen some answers that suggest using .iloc and some .loc as well as . I'd just like to know the proper way to read a specific portion of a dataframe, so that if later on I change what rows I want to read, I don't have to modify how I read it. What is the proper way to do this in pandas?

This will work as long as you are working with a copy of the dataframe. Df = df.