I'm sure this has been asked somewhere but I can't find it.. so apologies.
I have a dataframe: df and I want to say for column A and rows 0 to 10, give the values of x
but I need to do this in a loop.
I've used this code in my loop but it doesn't work. I know I need to use loc but can't see how to do columns and rows indexing
colname='A'
df[colname][:10]=x
This does work but it brings up that red box 100's of times, saying it's not a good way of doing it...
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy C:\Users\FSC05\AppData\Local\Continuum\anaconda3\lib\site-packages\ipykernel_launcher.py:18: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame
Thanks in advance for your help.
Fred