gpt4 book ai didi

pandas - pylint, Pandas : Comparison to True should be just 'expr' or 'expr is True' (singleton-comparison)

转载 作者:行者123 更新时间:2023-12-03 18:01:40 26 4
gpt4 key购买 nike

有没有人在使用 Pandas 时解决了这个 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_raw['is_standard'].isin([True])
df_current_dayparts_raw['is_standard'].__eq__(True)

最佳答案


  • 当我在 Mac 中使用 jupyter notebook 时。我没有收到此错误:


  • 获取 python 版本


  • import sys 
    print(sys.version)


  • 获取玩具数据集


  • import pandas as pd 
    data = pd.DataFrame({"A":['a', 'b', 'c', 'd'],"b": [1, 2, 3, 4]})
    data

    enter image description here

    关于pandas - pylint, Pandas : Comparison to True should be just 'expr' or 'expr is True' (singleton-comparison),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51657715/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com