I am getting the famous SettingWithCopyWarning when writing:
df['test'] = pd.factorize(df.test)[0]
I have tried
df.loc[:, 'test'] = pd.factorize(df.test)[0]
df.loc[:, ('test')] = pd.factorize(df.test)[0]
df[('test')] = pd.factorize(df.test)[0]
df.loc[df.index.tolist(), 'test'] = pd.factorize(df.test)[0]
but now sucess, the warning stays. I am not sure what I am doing wrong or how to deal with that. The point - and the difference to other questions at SO - that I do not want to use an indexer.
I also consulted http://pandas.pydata.org/pandas-docs/stable/indexing.html#returning-a-view-versus-a-copy without success.