Let's say I have a csv where a sample row looks like: [' ', 1, 2, 3, 4, 5]
where indicates an empty cell. I want to iterate through all of the rows in the .csv and replace all of the values in the first column for each row with another value, i.e.
[100, 1, 2, 3, 4, 5]
. How could this be done? It's also worth noting that the columns don't have labels (they were converted from an .xlsx).
Currently, I'm trying this:
for i, row in test.iterrows():
value = randomFunc(x, row)
test.loc[test.index[i], 0] = value
But this adds a column at the end with the label 0.