有人可以帮我吗?我正进入(状态
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
从以下代码:
import pandas as pd
testdf = pd.read_csv('../../IBM.csv')
print testdf
print "------------"
testdf['NHigh'] = 0
print testdf
if testdf['Close'] > testdf['Open']:
testdf['Nhigh'] = testdf['Close'] * testdf['High']
print "********"
print tested
我要做的是创建一个由两个现有列中的值填充的新列,但前提是条件为真。
该形状是一个带有以下列的股票数据框 -Open, High, Low,
Close
等等,我想添加一个新列 ( NHigh
) 基于sayClose
和High
if Close
is > than之间的操作High
。
谢谢,如果你能帮忙......