Я пытаюсь избавиться от SettingWithCopyWarning
.
моего кода:
combineQueryandBookFiltered['positionId'] = combineQueryandBookFiltered['positionId'].astype('int64')
combineQueryandBookFiltered.loc['pnlValue'] = np.multiply(combineQueryandBookFiltered['pnlValue'], df_fxrate['fx_rate'])
того, что я пытался:
combineQueryandBookFiltered['positionId'] = combineQueryandBookFiltered['positionId'].astype('int64').copy()
combineQueryandBookFiltered.loc['pnlValue'] = np.multiply(combineQueryandBookFiltered['pnlValue'], df_fxrate['fx_rate'])
консольного сообщения:
//stack/over/flow/code1.py:154: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
combineQueryandBookFiltered['positionId'] = combineQueryandBookFiltered['positionId'].astype('int64').copy()
//stack/over/flow/code1:156: 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
combineQueryandBookFiltered.loc['pnlValue'] = np.multiply(combineQueryandBookFiltered['pnlValue'], df_fxrate['fx_rate'])
Кто-нибудь может помочь устранить эти сообщения?