Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Update the column for each row in dataframe

$
0
0

Hi
I am trying to update the value of a column in df[“sqr”]

def excelsqrtfile(k):
f1=pd.DataFrame(k[‘values’])
if ‘com.infa.ldm.profiling.lastProfileTime’ in f1.attributeId.values:
t=‘Y’
else:
print(“NO”)
t=‘N’
return t

for x in get_list:
df[“sqr”]=excelsqrtfile(x)

for the first row, it returns - N and for the second row it returns the value - Y

But in the df[“sqr”] the values are showing as ‘Y’ for two rows. even though I could print the values as No and Yes in python.

Can you advise me where I am doing wrong?

My expectation is - for the first row of df[“sqr”] = N and for the second row df[“sqr”]= Y.

Many thanks in advance.

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles