import pandas as pd
from fbprophet import Prophet
path = './PycharmProjects/Stock_Test2/2020-09-18_dummy.log'
stock_dic = {}
stock_list =[]
f = open(path,'r',encoding='cp949')
lines = f.readlines()
for line in lines:
ls = line.split(',')
if len(ls) < 2:
continue
stock_code = ls[0][15:]
stock_cheGyuelTime = "20200918"+ls[1][6:]
stock_currentPrice = ls[2][5:]
stock_updown_percent = ls[4][5:]
stock_useon_mesu = ls[6][11:]
stock_guraeryang = ls[7][5:]
stock_dic.update({stock_code:{"종목코드":stock_code,
"채결시간":stock_cheGyuelTime,
"현재가":stock_currentPrice,
"등락율":stock_updown_percent,
"거래량":stock_guraeryang}
})
stock_list.append([stock_code,stock_cheGyuelTime,stock_currentPrice,stock_updown_percent,stock_guraeryang])
f.close()
my_df = pd.DataFrame(stock_list,columns=['종목코드','채결시간','현재가','등락율','거래량'])
#print(my_df)
my_df.head()
#my_df.tail()
new_df =my_df.loc[:,['종목코드','채결시간']]
new_df =my_df.loc[:,['채결시간','현재가']]
new_df
code034020_df = my_df.loc[my_df['종목코드'] == '034020']
code034020_df = code1_df.loc[:,['채결시간','현재가','종목코드']]
code034020_df
댓글 없음:
댓글 쓰기