0

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

Renma
  • 81
  • 1
  • 11
  • Would you like to remove these three columns or do you want to iterate over each row in them to find some values? – Arkadiusz Mar 04 '21 at 15:30
  • The goal is to iterate over each of these rows and print their values. So it should be every row's value of 'URN', 'GUID' and 'CODE'. – Renma Mar 04 '21 at 15:33
  • 1
    When you create a dataframe, you can do: df = pd.read_excel(filepath, usecols=['URN', 'GUID', 'CODE']) – Arkadiusz Mar 04 '21 at 15:38
  • Does this answer your question? [how to read certain columns from Excel using Pandas - Python](https://stackoverflow.com/questions/33655127/how-to-read-certain-columns-from-excel-using-pandas-python) – BigBen Mar 04 '21 at 15:41

1 Answers1

1

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

ashkangh
  • 1,594
  • 1
  • 6
  • 9