I am trying to build logic that compares two columns in a dataframe after some logic has been verified.
Here is my code, it is pulling historical rates for cryptocurrency data from gdax.com. The test condition I am applying is 'if df.column 4 is greater than sum of df.column4 and df.column3 then buy 10% of account'
import GDAX
import pandas as pd
import numpy as np
public_client = GDAX.PublicClient()
ticker_call = public_client.getProductHistoricRates(product='LTC-USD')
df = pd.DataFrame(ticker_call)
df['account']=100
if df[4] > df[3] + df[4]:
df['account_new'] = df['account']-df['account'] *.10
print df
I am getting the error 'ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().' for the if statement, what I dont understand is why? when I run each of the lines in the if statement individually they work. How can I fix this issue?
Why and how do I use a.bool() instead of an if statement?
thank you in advance.