简体   繁体   English

为什么此输出列表在此代码中不起作用?

[英]Why doesn't this output list work within this code?

I am trying to use an output within another line of code as a list. 我试图将另一行代码中的输出用作列表。 I want to find the product code where the ordernumber equals the following values: 我想找到订单号等于以下值的产品代码:

ordnumber = [10334, 10401, 10407, 10414]

The input: 输入:

(orderdetails_df.productcode).where(orderdetails_df.ordernumber == ordnumber)

I get back the error: 我得到了错误:

ValueError: Lengths must match to compare

我会这样:

orderdetails_df.loc[orderdetails_df.ordernumber.isin(ordnumber), productcode]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM