Python 从数据帧/系列中删除所有假值
我有一个只有两列的系列。(例如:(阿拉巴马州,阿拉巴马州)错误) 我想删除序列中的所有假值。我试过:Python 从数据帧/系列中删除所有假值,python,database,pandas,Python,Database,Pandas,我有一个只有两列的系列。(例如:(阿拉巴马州,阿拉巴马州)错误) 我想删除序列中的所有假值。我试过: p = test2[test2['Alabama','Alabama'] == True] 它适用于数据帧,但似乎不适用于系列。您可以执行以下操作: p = test2[test2==True] 或 对于Series,您不需要指定列。您只需执行以下操作: p = test2[test2==True] 或 对于Series,您不需要指定列 p = test2[test2]
p = test2[test2['Alabama','Alabama'] == True]
它适用于数据帧,但似乎不适用于系列。您可以执行以下操作:
p = test2[test2==True]
或
对于Series,您不需要指定列。您只需执行以下操作:
p = test2[test2==True]
或
对于Series,您不需要指定列
p = test2[test2]