Renma
Renma

Reputation: 81

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'?

Upvotes: 0

Views: 1543

Answers (1)

ashkangh
ashkangh

Reputation: 1624

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

Upvotes: 1

Related Questions