Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 带有或运算符的DataFrame UserWarning_Python_Regex_Python 3.x_Spark Dataframe - Fatal编程技术网

Python 带有或运算符的DataFrame UserWarning

Python 带有或运算符的DataFrame UserWarning,python,regex,python-3.x,spark-dataframe,Python,Regex,Python 3.x,Spark Dataframe,Python 3.6。我有数据帧警告: UserWarning:此模式具有匹配组。要实际获取组,请使用str.extract。 按照这种模式: laDataTemps.loc[laDataTemps['texte'].str.containsr'\bword1 | word2\b',regex=True] 或者,如果我删除括号以避免分组,它将不会有相同的含义。你知道我如何改变模式来消除警告吗?谢谢 使用: 这样,您就不会捕获任何文本并保留模式的语义,其中单词边界应用于每个备选方案的两端。完成,抱

Python 3.6。我有数据帧警告: UserWarning:此模式具有匹配组。要实际获取组,请使用str.extract。 按照这种模式: laDataTemps.loc[laDataTemps['texte'].str.containsr'\bword1 | word2\b',regex=True]

或者,如果我删除括号以避免分组,它将不会有相同的含义。你知道我如何改变模式来消除警告吗?谢谢

使用:


这样,您就不会捕获任何文本并保留模式的语义,其中单词边界应用于每个备选方案的两端。

完成,抱歉,我在等待5分钟的延迟后忘记了这是否回答了您的问题?
laDataTemps.loc[laDataTemps['texte'].str.contains(r'\b(?:word1|word2)\b', regex=True)]
                                                      ^^^