1

I want to compare the following, it's not giving error but not working means though condition is met, but it's not entering in 'if statement'

if df.index.values[i]>= pd.to_datetime('15:15:00'):

my dataframe is:

                       open    high     low  ...  william_R    atr     sma
dateTime                                     ...                          
2020-04-13 09:15:00  627.50  639.75  627.05  ...        NaN  12.70     NaN
2020-04-13 09:30:00  637.30  646.70  637.10  ...        NaN  12.48     NaN
2020-04-13 09:45:00  644.00  651.70  643.40  ...        NaN  12.18     NaN
2020-04-13 10:00:00  648.50  648.85  640.35  ...        NaN  11.92     NaN
2020-04-13 10:15:00  641.10  642.00  637.75  ...        NaN  11.37     NaN
...                     ...     ...     ...  ...        ...    ...     ...
2020-05-06 15:15:00  666.40  668.00  665.00  ...     -78.63   3.97  670.32
2020-05-07 09:15:00  666.35  674.35  665.55  ...     -60.31   4.32  669.97
2020-05-07 09:30:00  669.25  671.50  667.10  ...     -70.61   4.32  669.59
2020-05-07 09:45:00  668.50  671.00  666.05  ...     -51.91   4.37  669.42
2020-05-07 10:00:00  670.25  671.25  670.25  ...     -33.50   4.13  669.22
Mukul Jain
  • 11
  • 2
  • what is `i`, or more specifically `df.index.values[i]`? And are you aware that `pd.to_datetime('15:15:00')` will use the current date of your machine as date since the string only contains time? – FObersteiner May 07 '20 at 18:54
  • Does this answer your question? [Pandas - convert strings to time without date](https://stackoverflow.com/questions/32375471/pandas-convert-strings-to-time-without-date) – FObersteiner May 08 '20 at 07:07

0 Answers0