I have a price table that has date and time in a csv format:
Date Time o h l c v
0 2020-07-09 15:10:00 8 8 7.5 7.94 41
1 2020-07-09 15:00:00 7.61 8.24 7.61 8.24 10
2 2020-07-09 14:50:00 8.3 8.3 7.7 7.7 7
3 2020-07-09 14:40:00 8.72 8.72 8.3 8.3 7
4 2020-07-09 14:30:00 8.72 8.72 8.39 8.39 8
5 2020-07-09 14:20:00 8.35 8.6 8.3 8.6 6
6 2020-07-09 14:10:00 8.18 8.46 8.18 8.45 22
7 2020-07-09 14:00:00 8.5 8.5 8.5 8.5 1
ValueError: time data '0' does not match format '%Y-%m-%d %H:%M:%S'
This is the error I get from running these code snippets.
data = bt.feeds.GenericCSVData(dataname='ticks2.csv',
params = (
('nullvalue', float('NaN')),
('dtformat', '%Y/%m/%d'),# %H:%M:%S
('tmformat', '%H:%M:%S'),
('datetime', 0),
('time', 1),
('open', 2),
('high', 3),
('low', 4),
('close', 5),
('volume', 6),
I tried to merge Date and time columns for fixing this problem but to no avail...since the error stays the same.
df = pd.read_csv('ticks.csv', parse_dates=[['Date', 'Time']])
print(df)
del df["Unnamed: 0"]