Nov-15-2023, 08:43 PM
i have watched a tutorial about a neural network which i would like to train with this csv file. however, i have the problem that i always get this error when running it:
Traceback (most recent call last):
File "c:\xxxx\xxxx\xxxx\xxxx\xxxx.py", line 7, in <module>
data.index = pd.to_datetime(data.Time, format='%Y.%m.%d %H:%M:%S')
File "C:\xxxx\xxxx\xxxx\xxxx\xxxx\xxxx\xxxx\xxxx\xxxx\generic.py", line 5989, in __getattr__
return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'Time'
the csv file is build like this:
<DATE> <TIME> <BID> <ASK> <LAST> <VOLUME> <FLAGS>
2023.06.01 01:00:07.592 1962.69 1963.08 6
2023.06.01 01:00:07.831 1962.60 1963.05 6
etc.
and my code looks like this:
im pretty new to coding in python i really tried everything i could. please help me.:(
Traceback (most recent call last):
File "c:\xxxx\xxxx\xxxx\xxxx\xxxx.py", line 7, in <module>
data.index = pd.to_datetime(data.Time, format='%Y.%m.%d %H:%M:%S')
File "C:\xxxx\xxxx\xxxx\xxxx\xxxx\xxxx\xxxx\xxxx\xxxx\generic.py", line 5989, in __getattr__
return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'Time'
the csv file is build like this:
<DATE> <TIME> <BID> <ASK> <LAST> <VOLUME> <FLAGS>
2023.06.01 01:00:07.592 1962.69 1963.08 6
2023.06.01 01:00:07.831 1962.60 1963.05 6
etc.
and my code looks like this:
import numpy as np import pandas as pd import matplotlib.pyplot as plt import datetime data = pd.read_csv("XAUUSD2020_2023.csv") data.index = pd.to_datetime(data.Time, format='%Y.%m.%d %H:%M:%S') data1hrAsk = data.Ask.resample('60min').ohlc() data1hrAsk = data1hrAsk.dropna() train_data = data1hrAsk.close.to_list() ret = data1hrAsk.close.pct_change()--rest of the code--
im pretty new to coding in python i really tried everything i could. please help me.:(