Monday 15 April 2013

pandas: updating a row.


# remove a row, and append it again.  I need to remove a Ze value at a freq, and update it with a new value.
# Don't think I can update the value directly.
print df # original shows all rows
tmp = df[abs(df['A'] - -0.671540) < 1E-3]  # copy
df = df[abs(df['A'] - -0.671540) > 1E-3]  # this shows the first index to be removed.
print df
print df.append(tmp, ignore_index = True)

No comments:

Post a Comment