如何使用pandas

时间:2018-01-14 13:12:59

标签: python pandas select

我想只选择所有值等于0的行

我也尝试过使用&并删除括号。我每次都会收到此错误提示:

  train[(train['severe_toxic'] == 0) and
               (train['obscene'] == 0)  and
               (train['threat'] == 0) and
               (train['insult'] == 0) and  
               (train['identity_hate'] == 0) ]

    Traceback (most recent call last):

      File "<ipython-input-65-0768a788df43>", line 1, in <module>
        train[(train['severe_toxic'] == 0) and

      File "C:\Users\los40\Downloads\WinPython-64bit-3.5.4.1Qt5\python-3.5.4.amd64\lib\site-packages\pandas\core\generic.py", line 1121, in __nonzero__
        .format(self.__class__.__name__))

    ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

0 个答案:

没有答案