I'm trying to fill a cell in a dataframe with another one. I'm using this line:
submission.iloc[i, coli] = train2.iloc[i2, coli-1]
I'm getting this error line:
IndexError: iloc cannot enlarge its target object
What is the reason for this?
I'm trying to fill a cell in a dataframe with another one. I'm using this line:
submission.iloc[i, coli] = train2.iloc[i2, coli-1]
I'm getting this error line:
IndexError: iloc cannot enlarge its target object
What is the reason for this?
I think this happens because either 'i' or 'coli' is out of bounds in submission. According to the documentation, you can Enlarge the dataframe with loc, meaning it would add the required row and column (in either axis) if you assign a value to a row/column that currently does not exist, but apparently iloc will not do the same.