I am trying to add a value at a particular row and column but it is giving weird results:
After this when I again try to add a different value to same column, it is added correctly!!!!
I am trying to add a value at a particular row and column but it is giving weird results:
After this when I again try to add a different value to same column, it is added correctly!!!!
In the first scenario, .at
tries to find row with index 0
and column label ('00', '00')
. When it is not found, it creates a new row with index 0
and adds a new column '00'
. It treats the tuple as a list of columns and assigns value 34323
to each column.
In the second scenario, the row index and column label exist, hence the value is assigned to the respective cell.
For the first scenario, you can use the following for assignment-
df.at[k, [some_variable]] = 34323
This will treat some_variable
as a single column.