Q: 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.

A: As @Phillip Cloud points out, loc is better for this job. And if you specify the key as a tuple, you can multi-index set as well.
In [2]: mi = DataFrame(dict(
         A = np.arange(5).astype(np.float64), 
         B = np.arange(5).astype(np.int64)),
            index=MultiIndex.from_tuples(tuple(zip(*[['bar','bar','baz','baz','baz'],['one','two','one','two','three']])),names=['first','second']))

In [3]: mi
Out[3]: 
              A  B
first second      
bar   one     0  0
      two     1  1
baz   one     2  2
      two     3  3
      three   4  4

In [4]: mi.loc[('baz','two'),'B'] = -5

In [5]: mi
Out[5]: 
              A  B
first second      
bar   one     0  0
      two     1  1
baz   one     2  2
      two     3 -5
      three   4  4


A: xs() creates a copy of your data by default, so to modify the original data, you should pass copy=False:
for key,item in df.iterrows():
    df.xs(key, copy=False)['downloaded']=True

