df.loc [df.loc [:, 'Col1中'] str.contains( '_ ID'), 'col2的'。] = 'stringValue的'

时间:2018-05-31 04:57:15

标签: python pandas

我对一个适合我的数据框有一个布尔掩码:

df.loc[df.loc[:,'Col1'].str.contains('_id'),'Col2']='stringValue'

但得到错误

/opt/conda/lib/python3.6/site-packages/pandas/core/indexing.py:141: 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
  self._setitem_with_indexer(indexer, value)
/opt/conda/lib/python3.6/site-packages/ipykernel_launcher.py:1: 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
  """Entry point for launching an IPython kernel.

我已经研究了这个并且无法想出一种方法来编写它而不会得到任何帮助吗?

0 个答案:

没有答案