python - df.loc[df.loc[:,'Col1'].str.contains('_id'),'Col2']='stringValue'
问题描述
我对适用于我的数据框有一个布尔掩码:
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.
我已经对此进行了研究,并且无法想出一种方法来编写它而不会得到此错误的任何帮助?
解决方案
推荐阅读
- node.js - 角度和节点应用程序中的 CORS 不起作用
- azure - 更新 Azure Service Fabric 证书。为什么是一级证书和二级证书?
- c++ - 在 C++ 中可以有一个虚拟类型吗?
- python - 如何计算图像噪声的标准偏差?
- android - 如何解决必需的问题:只读片段中的 androidx.fragment.app.Fragment
- apache-flink - 基于优先级或轮询方式从两个 flink dataStream 中消费
- selenium - 如何获取 Google Chrome 版本 Azure DevOps 命令提示符
- python - 岭回归中的参数 Alpha 是什么?
- html - 有没有办法将此功能区放置在 html 电子邮件中的图像上,以便在 Outlook 等客户端上运行?
- sql - 获取每个月的平均经过时间