So I made an empty dataframe using
df=data[['ID','Matrix','Name','Country', 'Units']]
df['Value']=''
and I am filling it in with code like this, which finds strings containing values of 'Good', 'Bad' in df.Matrix
and filling them with values in sch[i]
:
df.loc[df.Matrix.str.contains('Good'),'Value'] = sch[2]
df.loc[df.Matrix.str.contains('Bad'),'Value'] = sch[6]
df.loc[df.Matrix.str.contains('Excellent'),'Value'] = sch[8]
I have been getting a bunch of errors like both of these two different ones:
C:\Python33\lib\site-packages\pandas\core\strings.py:184: UserWarning: This pattern has match groups. To actually get the groups, use str.extract.
" groups, use str.extract.", UserWarning)
C:\Users\0\Desktop\python\Sorter.py:57: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame
df.loc[df.Matrix.str.contains('Bad'),'Value'] = sch[6]
So far I am suppressing the code using
pd.options.mode.chained_assignment = None
If I do not suppress the error messages I will get about 20 of them. Is there another format I can change the data so that I do not get the error message?
I am using python 3 and pandas 0.131 if it helps