728x90
반응형
import datetime
import pyupbit
import pandas as pd
pd.options.display.max_rows = None
ticker = 'KRW-BTC'
interval = 'minute1'
to = '2020-07-30 03:03:00'
count = 5
period = 1
price_history = pyupbit.get_ohlcv(ticker=ticker,interval=interval,to=to,count=count,period=1)
# price_history_to_list = price_history.index.tolist(), price_history.values.tolist()
price_history['date'] = price_history.index.astype(str) # index 값을 별도 항목으로 저장
price_history_to_list = price_history.values.tolist() # 리스트로 변환
for lst in price_history_to_list: # 리스트의 항목(서브리스트)
# print(*index1, sep='\n')
# print(type(index1))
print(lst)
728x90
반응형
'프로그램' 카테고리의 다른 글
[파이썬] 문제 : pygame 아모도 적색편이(?) 시뮬레이션 코드 분석 (2) | 2022.11.23 |
---|---|
[파이썬] 문제 : pygame 행성 타원운동 시뮬레이션 코드 분석 (0) | 2022.11.23 |
[파이선] 문제 : 파일을 읽어 합계,평균 계산해 다른 파일로 저장하기 (0) | 2022.11.23 |
[파이썬] 문제 : 입력 받아 클래스에 저장 하기 (0) | 2022.11.23 |
[파이썬] 문제 : 초(second) 입력 받아 일/시/분/초로 출력 (0) | 2022.11.23 |
댓글