Pandas 派林,熊猫:与真实的比较应该是';expr';或';expr为真';(单例比较)

Pandas 派林,熊猫:与真实的比较应该是';expr';或';expr为真';(单例比较),pandas,dataframe,pylint,Pandas,Dataframe,Pylint,有人在使用熊猫时解决了派林问题吗 C:525,59: Comparison to True should be just 'expr' or 'expr is True' (singleton-comparison) 这发生在我使用的行中: df_current_dayparts_raw['is_standard'] == True 我尝试了这些,但没有成功: df_current_dayparts_raw['is_standard'] is True df_current_dayparts

有人在使用熊猫时解决了派林问题吗

C:525,59: Comparison to True should be just 'expr' or 'expr is True' (singleton-comparison)
这发生在我使用的行中:

df_current_dayparts_raw['is_standard'] == True
我尝试了这些,但没有成功:

df_current_dayparts_raw['is_standard'] is True
df_current_dayparts_raw['is_standard'].isin([True])
df_current_dayparts_raw['is_standard'].__eq__(True)
请尝试
numpy.equal(,True)
,而不是
==True
。具体地说:

import numpy as np
np.equal(df_current_dayparts_raw['is_standard'], True)
  • 当我在Mac中使用jupyter笔记本电脑时。我不明白这个错误:
  • 获取python版本
导入系统 打印(系统版本)
  • 获取玩具数据集
将熊猫作为pd导入
data=pd.DataFrame({“A”:['A','b','c','d','b:[1,2,3,4]})
数据

我认为这是pylint中的一个bug,您应该向报告。我也遇到过这个问题。我的工作是从
False
/
True
布尔值切换到
0
/
1
,但这并不是所有情况下的选项。