:)
我有这样一个数据帧(它是整个数据帧的摘录):
a b
1 1
6 3
7 5
1 7
12 5
12 5
2 5
95 2
44 3
考虑到前面的条件,我想在python中基于多个where条件使用NumPy创建一个新列。让我举例说明:
我想在以下情况下创建值为“1”的列“C”:
(a > b) and (a[-1] < b) and (the previous valued value of "c" must be 2)
另一个条件是“C”=“2”:
(a < b) and (the previous valued value of "c" must be 1)
谢谢你
您可以使用^{} 返回从choicelist中的元素绘制的数组,具体取决于条件。
使用:
这张照片是:
相关问题 更多 >
编程相关推荐