Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Select specific rows/columns xls file

I would like to select specific rows and columns in Python. I already use pandas somewhere in my code so I’d prefer a way to do it with this library.

I tried specific_row = pandas.read_excel('this_file.xls', "Entrees")[3] and specific_row = pandas.read_excel('this_file.xls', "Entrees", index_col = 2)[3] but I can’t seem to achieve it.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

you can use the "iloc" method and special which rows to select

specific_row = pandas.read_excel('this_file.xls', "Entrees").iloc[:3,:] #select 3 rows and every column
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading