我试图将time
值附加到plotList
,只要dup
列的值是False
。你知道吗
DF=
lat time trip_id diff shifted Segment dup
-7.12040 2015-12-24 02:03:10 18060.0 0.00003 0.00000 1 False
-7.12043 2015-12-24 02:03:12 18060.0 0.00000 0.00003 2 False
-7.12043 2015-12-24 02:03:14 18060.0 0.00003 0.00003 2 True
-7.12046 2015-12-24 02:03:16 18060.0 0.00003 0.00003 2 True
-7.12049 2015-12-24 02:03:19 18060.0 0.00003 0.00000 3 False
-7.12052 2015-12-24 02:03:22 18060.0 0.00000 -0.00473 4 False
代码=
plotList=[]
def pullLine(row):
if row['dup'] == False:
plotList.append(row['time'])
pullLine(df)
我原以为这可能行得通,但我得到的错误是ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
有人能解释一下a)这里发生了什么,b)我能做些什么来避免吗?我不明白问什么是False
怎么会模棱两可。你知道吗
非常感谢。你知道吗
我只想在
dup
列上使用否定~
进行筛选,因为您正在筛选False。你知道吗如果您真的想要列表格式:
我想你可以这样做:
您将整个DF作为参数传递给函数,但将其视为一行。。。你知道吗
根据要获取的内容-数组或列表:
相关问题 更多 >
编程相关推荐