简体   繁体   中英

How do I use Pandas to iterate through an xlsx sheet and only read certain columns?

Suppose I have an excel sheet with the fields 'URN' 'GUID', and 'CODE', along with a few other columns. Is there a way I can use the python pandas library to iterate through each row and pull out it's respective values for 'URN' 'GUID', and 'CODE'?

I suppose you are just willing to read certain columns, from your excel file:

df = pd.read_excel(path_of_your_file, usecols=['URN', 'GUID', 'CODE'])

Then you can iterate through rows of df

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM