I have a column in a pandas dataframe
dfr
in which there is a empty list. When I try to append it, the entire column is changed.
Below is the code attached.
N = 10
Nr = list(range(10))
dfr = pd.DataFrame(Nr,columns = ['ID'])
dfr['Assignment'] = [[]] * dfr.shape[0]
for i in range(N):
dfr.loc[i][1].append(i)
dfr
Now when I run this, the whole assignment column changes. Can anyone help me here. I just need to have 1 value of i
in the list in each row.