0

trying to Compare 2 Columns lag2open to MGC=F and return if it is higher and returning it as Higher than 0

using GCClose["Higher than 0"] = [GCClose.columns[1]]>= [GCClose.columns[0]] it always returns True, while the validation column diff doesn't support that idea

Anyone can Explain to me what i am doing wrong? Example

2
  • Isn't column 0 the date? Commented Jul 16 at 17:03
  • column 0 is MGC=F Double checked both columns Commented Jul 16 at 17:10

1 Answer 1

3

If I understand your intention:

GCClose.columns[1] is the NAME of the column not its contents (try printing it)

You could use either:

 = GCClose[GCClose.columns[1]] >= GCClose[GCClose.columns[0]]

or

 = GCClose.iloc[:,1] >= GCClose.iloc[:,0]

or simplest

 = GCClose['lag2Open'] >= GCClose['MGC=F']
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much, used the first example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.