Monday, 9 September 2013

Updating a single cell for a key in pandas

Updating a single cell for a key in pandas

I'm trying to iterate through items in a dataframe and update the current
row.
I am iterating ( rather than using df.apply ) as I need to process files
based on the values in the dataframe. Note: for various reasons I do not
want to use df.apply here.
df is the dataframe
for key,item in df.iterrows():
df.xs(key)['downloaded']=True
if I do
df[:5]
the field 'downloaded' hasn't been updated (It shows as False). How do I
get this to update correctly?
Essentially what I want to do is update a single column value for a given
key.

No comments:

Post a Comment