I have tried the following to convert the time to Indian time for testing. But got many errors. See what I tried til now:
>>> df = pd.read_csv("Real.csv",encoding='utf-16',index_col=0)
>>> df.tail(1).index
Index(['2018.09.27 16:43:00'], dtype='object', name='Time')
>>> df.tail(1).index.tz_convert('Asia/Kolkata')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Index' object has no attribute 'tz_convert'
>>> df.index.tz_convert('Asia/Kolkata').tail(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Index' object has no attribute 'tz_convert'
>>> df.index.tz_localize('GMT').tz_convert('Asia/Kolkata').tail(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Index' object has no attribute 'tz_localize'
Here is the sample csv:
2018.09.27 16:34:00,0.94259,0.94276,0.94253,0.94276,0.002,-0.004,-0.001,-0.001,-0.007,0.001,0.002,0.001
2018.09.27 16:35:00,0.94275,0.94275,0.94249,0.94253,0.002,-0.002,-0.001,0,-0.006,0.002,0,0.001
2018.09.27 16:36:00,0.94253,0.94259,0.94235,0.94241,0,-0.003,0,0,-0.005,-0.001,0.001,0.002
2018.09.27 16:37:00,0.94241,0.94258,0.94237,0.94256,0,-0.003,0,0.001,-0.005,0,0.001,0.001
2018.09.27 16:38:00,0.94256,0.94256,0.94238,0.94245,0.001,0,0.001,0.005,0.001,0.001,-0.002,-0.001
2018.09.27 16:39:00,0.94246,0.9426,0.9423899999999999,0.94254,0.001,0,-0.001,0.003,-0.001,0.002,-0.001,0
2018.09.27 16:40:00,0.94252,0.94275,0.94252,0.94274,0.002,0.001,0,0.003,0,0.003,-0.002,-0.001
2018.09.27 16:41:00,0.94274,0.94278,0.94265,0.94268,0.001,-0.002,-0.001,0.002,-0.001,0.002,0.001,-0.001
2018.09.27 16:42:00,0.94268,0.94285,0.94268,0.94272,0,-0.001,0.001,0.002,-0.002,0.002,0,-0.001
2018.09.27 16:43:00,0.94272,0.94282,0.9426600000000001,0.9428,0.001,-0.001,0.002,0.001,-0.002,0.002,0,0
I am trying to check if the last index, which is Time, is equal to the current time as per IST. The Time in the file is of GMT format.
Kindly, help me check the condition for the Time check. Let me know what I am missing.