I have the following database:
time open high low close
0 2021-07-29 21:12:18 131.50 131.51 131.45 131.45
1 2021-07-29 21:14:49 131.40 131.50 131.40 131.41
2 2021-07-29 21:20:56 131.62 131.62 131.62 131.62
3 2021-07-29 21:20:56 131.41 131.50 131.40 131.40
4 2021-07-29 21:22:28 131.36 131.40 131.31 131.40
.. ... ... ... ... ...
259 2021-07-30 09:05:26 130.19 130.26 130.16 130.17
260 2021-07-30 09:07:16 130.15 130.20 130.10 130.20
261 2021-07-30 09:08:10 130.21 130.29 130.19 130.29
262 2021-07-30 09:09:10 130.30 130.37 130.27 130.37
263 2021-07-30 09:09:56 130.38 130.40 130.30 130.30
[264 rows x 5 columns]
This code successfully prints the varible 'time' to a csv file:
import pandas
row = [0]
range_interval = [10]
def strategy_tester():
dataframe = pandas.read_csv('file.csv')
while row[-1] < len(dataframe.index):
time = dataframe.iloc[row[-1], 0]
# open = dataframe.iloc[row[-1], 1]
print(time, file = open('txt.txt', 'a'))
row.append(row[-1] + 1)
while range_interval[-1] < 11:
strategy_tester()
range_interval.append(range[-1] + 1)
However, when I don't comment out open = dataframe.iloc[row[-1], 1]
I get 'numpy.float64' object is not callable. I also find it confusing that when I print 'time' to the terminal (e.g. print(time)
) and I don't comment out open = dataframe.iloc[row[-1], 1]
the code works fine without errors.
Any idea as to why this error is occurring?