-6

Data of Csv

 import pandas as pd
    import csv
    df = pd.read_csv('niftsuper50.csv')
    close = df.Close
    supertrend = df.st

    if (close > supertrend):
        print (close)

I need the Value of Close column where its being true

  • Please provide example of your data. Your answer lies here: https://stackoverflow.com/questions/17071871/select-rows-from-a-dataframe-based-on-values-in-a-column-in-pandas – Erfan Mar 05 '19 at 13:34
  • Possible duplicate of [Select rows from a DataFrame based on values in a column in pandas](https://stackoverflow.com/questions/17071871/select-rows-from-a-dataframe-based-on-values-in-a-column-in-pandas) – Erfan Mar 05 '19 at 13:35
  • data image kept – Bhupathi office Mar 05 '19 at 13:40
  • Possible duplicate of [Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()](https://stackoverflow.com/questions/36921951/truth-value-of-a-series-is-ambiguous-use-a-empty-a-bool-a-item-a-any-o) – betelgeuse Apr 25 '19 at 12:13

2 Answers2

0

This should work, but you did not supply your full code, so it is hard to know if it is what you wanted. df = df[df['Close']>supertrend]

Scott Ulmer
  • 139
  • 11
0

Close seems to be a keyword .. so try to use df["close"] and try compare

selvaram s
  • 92
  • 2