인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

jangtaesan's profile image
jangtaesan

asked

Introduction to Python and Creating Various Automated Applications Using Web Crawling

Using Python Pandas (3) - Next, Naver Stock Charts (Charts)

4-7-6 네이버 & 카카오 주식 정보 가져오기

Written on

·

314

0

# [22년 8월 31일 확인]

# https://financedata.github.io/posts/finance-data-reader-users-guide.html
# pip install FinanceDataReader
import FinanceDataReader as fdr

import matplotlib.pyplot as plt

# import pandas_datareader.data as web

import FinanceDataReader as fdr

import datetime

# 조회 시작 및 종료 날짜

start = datetime.datetime(2022,8,16)

end = datetime.datetime(2022,8,31)

# 네이버 주식 정보 조회

df_naver = fdr.DataReader('035420', start, end)

# 카카오 주식 정보 조회

df_kakao = fdr.DataReader('035720', start, end)

# 출력

print(df_naver)

print(df_kakao)

# 윈도우 제목

fig = plt.figure('Chart Test')

# 차트 사이즈 지정

fig.set_size_inches(10, 6, forward=True)

# 차트 설정 1

plt.plot(df_naver.index, df_naver['Close'], 'b', label="Naver")

# 차트 설정 2

plt.plot(df_kakao.index, df_kakao['Close'], 'r', label="Kakao")

# 범례 위치 지정

plt.legend(loc='upper left')

# 차트 제목

plt.title('Naver & Kakao')

# x축 레이블

plt.xlabel('Date')

# y축 레이블

plt.ylabel('Close')

# 차트 실행

plt.show()

python웹-크롤링

Answer 1

0

niceman님의 프로필 이미지
niceman
Instructor

네 실행한 번 해볼께여~~

감사합니다.

jangtaesan's profile image
jangtaesan

asked

Ask a question