这是数据帧信息:
new_final.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 12 entries, 1 to 13
Data columns (total 9 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 DorW 12 non-null object
1 date 12 non-null object
2 source 12 non-null object
3 AU 12 non-null int32
4 impressions 12 non-null int32
5 clicks 12 non-null int32
6 pdp 12 non-null int32
7 CABN 12 non-null int32
8 order_completed 12 non-null int32
dtypes: int32(6), object(3)
memory usage: 672.0+ bytes
我想要一个新的专栏,它是pdp/impression的一部分,我已经尝试了所有这些方法,但仍然得到这些错误,我该如何修复它
new_final['impression_to_pdp'] = (new_final['pdp']/new_final['impressions'])
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
new_final['impression_to_pdp'] = (new_final['pdp']/new_final['impressions']).any()
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
new_final['impression_to_pdp'] = (new_final['pdp']/new_final['impressions']).all()
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
纯粹的尝试和错误,您是否在没有括号的情况下尝试过
如果它们是包含在列表中的普通整数,则应该以这种方式工作
但是,如果它们是numpy数组,那么您必须像
相关问题 更多 >
编程相关推荐