I have an Excel Sheet where for some of the columns uniqueidentifier
is set to "yes" and for rest of them it is blank.
Using the Pandas library, I get the data that have no value in uniqueidentifier
using the following command:
df=pandas.read_excel("sample.xlsx")
df=df[df.uniqueidentifier != "yes"]
I then want to write "yes" to the uniqueidenfier
column every time I loop through the index in the excel file.
list=[]
for i in df.index
list.append(df['Subject'][i])
# do some function here
var="some value"
Every time I get the proper values in list
and in var
for the respective index. I want my function to write something to the uniqueidentifier
column for that i
value in the loop (for example, if in row 4, then when uniqueidentifier
is not set, the list should take the value from the subject and append and write "yes" to uniqueidentifier
column)
In addition to the above, I want to write the var
value to an adjacent column in the excel file.
Could someone help me as I am new to python and stuck here?