I am new to Python pandas library and using data frames. I am using Jupyter. I kind of lost with this syntax.
I want to loop through rows and set new value to column new_value. I thought I would do it like this, but it raises an error.
df_merged['new_value'] = 0
for i, row in df_merged.iterrows():
df_merged['new_value'][i] = i
I also tried to do a calculation like:
df_merged['new_value'][i] = df_merged['move_%'] * df_merged['value']
But it doesnt work.
I am getting this error:
/usr/lib/python3.4/site-packages/ipykernel_launcher.py:4: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: http://pandas.pydata.org/pandas- docs/stable/indexing.html#indexing-view-versus-copy after removing the cwd from sys.path.
What I am doing wrong here?
Thanks.