Say I do have the following table
longitude | latitude | temperature | label |
---|---|---|---|
x | y | z | 1 |
p | q | r | 2 |
a | b | c | 1 |
k | l | m | 1 |
I store the table in df and run the following data fragment query.
df1= df.query('longitude == @x and latitude == @y and temperature== @z')
Mostly I am getting the correct output.
Now I want to change the label value for my row matched by the query
df.query('longitude == a and latitude == b and temperature== c')
How can I update the label value matched by the query row. I tried using .replace , .iloc but None of them is giving me proper result.
https://stackoverflow.com/questions/66811330/how-to-change-column-value-by-matching-row-value-in-data-frame March 26, 2021 at 01:06PM
没有评论:
发表评论