I tried to run the following code:
#%% add offsests and remove not qualified data
df=df[df['surfHeightr1_qual']==0] # eliminate values where the quality flag == 1
#add offset to SIN SurfType 1 and 3 --> this is needed when data is baseline C
if df['surfHeightr1'][(df['OPERATION_MODE']=='SIR_SIN_L2') & (df['surfType']==1) & (df['BaselineID']=='C')].any() == True:
df['surfHeightr1'][(df['OPERATION_MODE']=='SIR_SIN_L2') & (df['surfType']==1)& (df['BaselineID']=='C')]=df['surfHeightr1'][(df['OPERATION_MODE']=='SIR_SIN_L2') & (df['surfType']==1)& (df['BaselineID']=='C')]+59.959
if df['surfHeightr1'][(df['OPERATION_MODE']=='SIR_SIN_L2') & (df['surfType']==3)& (df['BaselineID']=='C')].any() == True:
df['surfHeightr1'][(df['OPERATION_MODE']=='SIR_SIN_L2') & (df['surfType']==3)& (df['BaselineID']=='C')]=df['surfHeightr1'][(df['OPERATION_MODE']=='SIR_SIN_L2') & (df['surfType']==3)& (df['BaselineID']=='C')]+59.959
in Python, but I get the folowing error:
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
df['surfHeightr1'][(df['OPERATION_MODE']=='SIR_SIN_L2') & (df['surfType']==3)& (df['BaselineID']=='C')]=df['surfHeightr1'][(df['OPERATION_MODE']=='SIR_SIN_L2') & (df['surfType']==3)& (df['BaselineID']=='C')]+59.959
Interestingly the error occur only at the second if, so I don't understand why the error occur. Also all following usages of df
is ignored by the code.
I use Python 3.6.3 with Anaconda in Ubuntui 16.04.
Does someone has an idea?
Thank you very much in advacne!