Код: Выделить всё
ohlc = pd.DataFrame(columns=('Open','High','Low','Close'))
for row in ohlc:
ohlc.loc[10] = pd.DataFrame([[candle_open_price,candle_high_price,candle_low_price,candle_close_price]])
Код: Выделить всё
ValueError: cannot set a row with mismatched columns
РЕДАКТИРОВАТЬ
Код: Выделить всё
import numpy as np
import pandas as pd
import datetime as dt
import matplotlib as plt
import dateutil.parser
tradedata = pd.read_csv('ICICIBANK_TradeData.csv', index_col=False,
names=['Datetime','Price'],
header=0)
tradedata['Datetime'] = pd.to_datetime(tradedata['Datetime'])
first_trd_time = tradedata['Datetime'][0]
last_time = dateutil.parser.parse('2016-01-01 15:30:00.000000')
candle_time = 15;
candle_number = 0
while(first_trd_time < last_time):
candledata = tradedata[(tradedata['Datetime']>first_trd_time) & (tradedata['Datetime']
Подробнее здесь: [url]https://stackoverflow.com/questions/40232520/how-do-i-incrementally-add-rows-in-pandas-dataframe[/url]