월 17,820원
5개월 할부 시다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
[2/5] plotly express 를 통한 일별 시세 시각화
plotly express 예제 중 질문입니다.1. 우분투 버전(base) root@gd-virtual-machine:~# cat /etc/issueUbuntu 20.04.4 LTS \n \l2. 파이썬 버전(base) root@gd-virtual-machine:~# python --versionPython 3.9.73. 공부하는 부분[2/5] plotly express를 통한 일별 시세 시각화px.line 을 처음에 실행하면 그래프가 나옵니다.그러나, 저장된 파일로 실행하면 그래프가 안 나옵니다.이런 경우도 보셨나요?4. 해당 소스import plotly.express as pximport pandas as pddf = px.data.stocks()dfpx.line(df, x="date", y="GOOG") 처음 실행은 정상적으로 그래프가 나옴저장된 파일로 실행하면 비정상적으로 그래프가 나오지 않음
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
Yahoo Finance에서 URL 가져오기
이 강의를 듣고 나면 네이버금융 뿐만 아니라 다른 웹 스크래핑도 가능할 것이라 하셨는데, 처음부터 너무 막히니 속상하네요. 스크립트는 다음과 같습니다. import pandas as pdfrom bs4 import BeautifulSoup as bs url = f"https://finance.yahoo.com/quote/YM%3DF/history?p=YM%3DF"table = pd.read_html(url)response = requests.get(url, headers = headers)html = bs(response.text)table = html.select("table")temp = pd.read_html(str(table))temp[0] 여기서 url부터 인식을 못하고 HTTPError가 뜹니다. 해결방법이 있을까요? HTTPError: HTTP Error 404: Not Found
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
아나콘다 프롬프트로 설치시에 !pip 와 pip 랑 차이가 잇나요
윈도우10 환경이고요. 아나콘다프로프트 창에서 !pip install 이 오류가 나서 구글에서 이것저것찾아보다 대부분 pip설치 알려주는글들이 느낌표 없이 pip 만 쓰는게 보이길래, 저도느낌표 빼고 pip install 로 진행하니 설치가 됬습니다. 느낌표를 쓰는 이유가 뭔지 궁굼합니다. 주피터안에서 설치할때만 느낌표 쓰는건가요
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
데이터 전체에 대한 수익률을 계산하고 싶은데 오류가 뜹니다
배운걸 활용해 Financial Data Reader KRX종목 전부에 대한 수익률을 계산하려고 합니다. #다음 수식으로 FDR df의 "Name"과 "Symbol"만 남겼고 df_dic = df[["Name", "Symbol"]]df_dictionary = df_dic.valuesdf_dictionary #dict 함수를 활용해 numpy array를 dictionary 형태로 변환했습니다. df_list = dict(df_dictionary)df_list #수업에서 배운대로 다음 수식을 적어 상장종목 전부에 대한 종가를 얻으려고 했는데 item_list = []for item_code in df_list.values(): close = fdr.DataReader(item_code, "2020", "2023")['Close'] item_list.append(close) #다음과 같은 에러메시지가 뜹니다 eyError Traceback (most recent call last) ~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance) 3360 try: -> 3361 return self._engine.get_loc(casted_key) 3362 except KeyError as err: ~\anaconda3\lib\site-packages\pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc() ~\anaconda3\lib\site-packages\pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc() pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item() pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item() KeyError: 'Close' The above exception was the direct cause of the following exception: KeyError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_96644/3549058376.py in <module> 1 item_list = [] 2 for item_code in df_list.values(): ----> 3 close = fdr.DataReader(item_code, "2020", "2023")['Close'] 4 item_list.append(close) ~\anaconda3\lib\site-packages\pandas\core\frame.py in __getitem__(self, key) 3456 if self.columns.nlevels > 1: 3457 return self._getitem_multilevel(key) -> 3458 indexer = self.columns.get_loc(key) 3459 if is_integer(indexer): 3460 indexer = [indexer] ~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance) 3361 return self._engine.get_loc(casted_key) 3362 except KeyError as err: -> 3363 raise KeyError(key) from err 3364 3365 if is_scalar(key) and isna(key) and not self.hasnans: KeyError: 'Close'이거 혹시 2020~2022 사이 종가데이터가 없는 종목이 있어서 그런건가요?
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
한글폰트가 깨집니다
def get_font_family(): """ 시스템 환경에 따른 기본 폰트명을 반환하는 함수 """ import platform system_name = platform.system() # colab 사용자는 system_name이 'Linux'로 확인 if system_name == "Darwin" : font_family = "AppleGothic" elif system_name == "Windows": font_family = "Malgun Gothic" else: !apt-get install fonts-nanum -qq > /dev/null !fc-cache -fv import matplotlib as mpl mpl.font_manager._rebuild() findfont = mpl.font_manager.fontManager.findfont mpl.font_manager.findfont = findfont mpl.backends.backend_agg.findfont = findfont font_family = "NanumBarunGothic" return font_family 이렇게 설정하고 get_font_family()하면 'Malgun Gothic' 제대로 나오고 # 시각화를 위한 폰트설정import matplotlib.pyplot as plt # 위에서 만든 함수를 통해 시스템 폰트를 불러와서 font_family 라는 변수에 할당font_family = get_font_family() # 폰트설정plt.rc("font", family = "font_family") # 마이너스폰트 설정plt.rc("axes", unicode_minus = False) 그래프 스타일 설정plt.style.use("ggplot") 이걸 돌렸는데도 # 한글폰트 확인pd.Series([1, -3]).plot(title="한글폰트") 하면 깨져서 나옵니다. C:\Users\August\anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py:240: RuntimeWarning: Glyph 54620 missing from current font. font.set_text(s, 0.0, flags=flags)어떻게 하면 좋을까요?
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
데이터 시각화 도구 소개와 한글폰트 설정 에러
데이터 시각화 도구 소개와 한글폰트 설정 에러 위에 강좌를 실습 중에 에러가 발생합니다. 우분투, 주피터노트북 사용, 나눔바른고딕 폰트 있습니다. 도와주세요!!!! 1. 우분투에 나눔바른고딕 폰트 있음: 제가 실습하는 환경 (base) root@gd-virtual-machine:/usr/share/fonts/truetype/nanum# lsb_release -d Description: Ubuntu 20.04.4 LTS (base) root@gd-virtual-machine:/usr/share/fonts/truetype/nanum# (base) root@gd-virtual-machine:/usr/share/fonts/truetype/nanum# (base) root@gd-virtual-machine:/usr/share/fonts/truetype/nanum# ls NanumBarunGothic.ttf NanumBarunGothic.ttf (base) root@gd-virtual-machine:/usr/share/fonts/truetype/nanum# 2. 에러 발생(강의 코드) def get_font_family(): import platform system_name = platform.system() if system_name == "Darwin" : font_family = "AppleGothic" elif system_name == "Windows": font_family = "Malgun Gothic" else: import matplotlib.font_manager as fm fontpath = '/usr/share/fonts/truetype/nanum/NanumBarunGothic.ttf' font = fm.FontProperties(fname=fontpath, size=9) fm._rebuild() font_family = "NanumBarunGothic" return font_family AttributeError Traceback (most recent call last) /tmp/ipykernel_1662/385091406.py in <module> ----> 1 get_font_family() /tmp/ipykernel_1662/3056356644.py in get_font_family() 11 fontpath = '/usr/share/fonts/truetype/nanum/NanumBarunGothic.ttf' 12 font = fm.FontProperties(fname=fontpath, size=9) ---> 13 fm._rebuild() 14 font_family = "NanumBarunGothic" 15 return font_family AttributeError: module 'matplotlib.font_manager' has no attribute '_rebuild' 3. 에러 발생(수업자료 소스 코드) def get_font_family(): """ 시스템 환경에 따른 기본 폰트명을 반환하는 함수 """ import platform system_name = platform.system() if system_name == "Darwin" : font_family = "AppleGothic" elif system_name == "Windows": font_family = "Malgun Gothic" else: # Linux(colab) !apt-get install fonts-nanum -qq > /dev/null !fc-cache -fv import matplotlib as mpl mpl.font_manager._rebuild() findfont = mpl.font_manager.fontManager.findfont mpl.font_manager.findfont = findfont mpl.backends.backend_agg.findfont = findfont font_family = "NanumBarunGothic" return font_family /usr/share/fonts: caching, new cache contents: 0 fonts, 6 dirs /usr/share/fonts/X11: caching, new cache contents: 0 fonts, 4 dirs /usr/share/fonts/X11/Type1: caching, new cache contents: 8 fonts, 0 dirs /usr/share/fonts/X11/encodings: caching, new cache contents: 0 fonts, 1 dirs /usr/share/fonts/X11/encodings/large: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/X11/misc: caching, new cache contents: 89 fonts, 0 dirs /usr/share/fonts/X11/util: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/cMap: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/cmap: caching, new cache contents: 0 fonts, 5 dirs /usr/share/fonts/cmap/adobe-cns1: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/cmap/adobe-gb1: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/cmap/adobe-japan1: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/cmap/adobe-japan2: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/cmap/adobe-korea1: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/opentype: caching, new cache contents: 0 fonts, 3 dirs /usr/share/fonts/opentype/malayalam: caching, new cache contents: 7 fonts, 0 dirs /usr/share/fonts/opentype/noto: caching, new cache contents: 28 fonts, 0 dirs /usr/share/fonts/opentype/urw-base35: caching, new cache contents: 35 fonts, 0 dirs /usr/share/fonts/truetype: caching, new cache contents: 0 fonts, 50 dirs /usr/share/fonts/truetype/Gargi: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/Gubbi: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/Nakula: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/Navilu: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/Sahadeva: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/Sarai: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/abyssinica: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/arphic: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/truetype/dejavu: caching, new cache contents: 6 fonts, 0 dirs /usr/share/fonts/truetype/droid: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/fonts-beng-extra: caching, new cache contents: 6 fonts, 0 dirs /usr/share/fonts/truetype/fonts-deva-extra: caching, new cache contents: 3 fonts, 0 dirs /usr/share/fonts/truetype/fonts-gujr-extra: caching, new cache contents: 5 fonts, 0 dirs /usr/share/fonts/truetype/fonts-guru-extra: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/fonts-kalapi: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/fonts-orya-extra: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/fonts-telu-extra: caching, new cache contents: 2 fonts, 0 dirs /usr/share/fonts/truetype/fonts-yrsa-rasa: caching, new cache contents: 10 fonts, 0 dirs /usr/share/fonts/truetype/freefont: caching, new cache contents: 12 fonts, 0 dirs /usr/share/fonts/truetype/kacst: caching, new cache contents: 15 fonts, 0 dirs /usr/share/fonts/truetype/kacst-one: caching, new cache contents: 2 fonts, 0 dirs /usr/share/fonts/truetype/lao: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/liberation: caching, new cache contents: 16 fonts, 0 dirs /usr/share/fonts/truetype/liberation2: caching, new cache contents: 12 fonts, 0 dirs /usr/share/fonts/truetype/lohit-assamese: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/lohit-bengali: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/lohit-devanagari: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/lohit-gujarati: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/lohit-kannada: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/lohit-malayalam: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/lohit-oriya: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/lohit-punjabi: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/lohit-tamil: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/lohit-tamil-classical: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/lohit-telugu: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/lyx: caching, new cache contents: 11 fonts, 0 dirs /usr/share/fonts/truetype/malayalam: caching, new cache contents: 10 fonts, 0 dirs /usr/share/fonts/truetype/nanum: caching, new cache contents: 31 fonts, 0 dirs /usr/share/fonts/truetype/noto: caching, new cache contents: 2 fonts, 0 dirs /usr/share/fonts/truetype/openoffice: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/padauk: caching, new cache contents: 4 fonts, 0 dirs /usr/share/fonts/truetype/pagul: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/samyak: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/samyak-fonts: caching, new cache contents: 3 fonts, 0 dirs /usr/share/fonts/truetype/sinhala: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/tibetan-machine: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/truetype/tlwg: caching, new cache contents: 58 fonts, 0 dirs /usr/share/fonts/truetype/ttf-bitstream-vera: caching, new cache contents: 10 fonts, 0 dirs /usr/share/fonts/truetype/ttf-khmeros-core: caching, new cache contents: 2 fonts, 0 dirs /usr/share/fonts/truetype/ubuntu: caching, new cache contents: 14 fonts, 0 dirs /usr/share/fonts/type1: caching, new cache contents: 0 fonts, 1 dirs /usr/share/fonts/type1/urw-base35: caching, new cache contents: 35 fonts, 0 dirs /root/anaconda3/fonts: skipping, no such directory /root/.local/share/fonts: skipping, no such directory /root/.fonts: skipping, no such directory /usr/share/fonts/X11: skipping, looped directory detected /usr/share/fonts/cMap: skipping, looped directory detected /usr/share/fonts/cmap: skipping, looped directory detected /usr/share/fonts/opentype: skipping, looped directory detected /usr/share/fonts/truetype: skipping, looped directory detected /usr/share/fonts/type1: skipping, looped directory detected /usr/share/fonts/X11/Type1: skipping, looped directory detected /usr/share/fonts/X11/encodings: skipping, looped directory detected /usr/share/fonts/X11/misc: skipping, looped directory detected /usr/share/fonts/X11/util: skipping, looped directory detected /usr/share/fonts/cmap/adobe-cns1: skipping, looped directory detected /usr/share/fonts/cmap/adobe-gb1: skipping, looped directory detected /usr/share/fonts/cmap/adobe-japan1: skipping, looped directory detected /usr/share/fonts/cmap/adobe-japan2: skipping, looped directory detected /usr/share/fonts/cmap/adobe-korea1: skipping, looped directory detected /usr/share/fonts/opentype/malayalam: skipping, looped directory detected /usr/share/fonts/opentype/noto: skipping, looped directory detected /usr/share/fonts/opentype/urw-base35: skipping, looped directory detected /usr/share/fonts/truetype/Gargi: skipping, looped directory detected /usr/share/fonts/truetype/Gubbi: skipping, looped directory detected /usr/share/fonts/truetype/Nakula: skipping, looped directory detected /usr/share/fonts/truetype/Navilu: skipping, looped directory detected /usr/share/fonts/truetype/Sahadeva: skipping, looped directory detected /usr/share/fonts/truetype/Sarai: skipping, looped directory detected /usr/share/fonts/truetype/abyssinica: skipping, looped directory detected /usr/share/fonts/truetype/arphic: skipping, looped directory detected /usr/share/fonts/truetype/dejavu: skipping, looped directory detected /usr/share/fonts/truetype/droid: skipping, looped directory detected /usr/share/fonts/truetype/fonts-beng-extra: skipping, looped directory detected /usr/share/fonts/truetype/fonts-deva-extra: skipping, looped directory detected /usr/share/fonts/truetype/fonts-gujr-extra: skipping, looped directory detected /usr/share/fonts/truetype/fonts-guru-extra: skipping, looped directory detected /usr/share/fonts/truetype/fonts-kalapi: skipping, looped directory detected /usr/share/fonts/truetype/fonts-orya-extra: skipping, looped directory detected /usr/share/fonts/truetype/fonts-telu-extra: skipping, looped directory detected /usr/share/fonts/truetype/fonts-yrsa-rasa: skipping, looped directory detected /usr/share/fonts/truetype/freefont: skipping, looped directory detected /usr/share/fonts/truetype/kacst: skipping, looped directory detected /usr/share/fonts/truetype/kacst-one: skipping, looped directory detected /usr/share/fonts/truetype/lao: skipping, looped directory detected /usr/share/fonts/truetype/liberation: skipping, looped directory detected /usr/share/fonts/truetype/liberation2: skipping, looped directory detected /usr/share/fonts/truetype/lohit-assamese: skipping, looped directory detected /usr/share/fonts/truetype/lohit-bengali: skipping, looped directory detected /usr/share/fonts/truetype/lohit-devanagari: skipping, looped directory detected /usr/share/fonts/truetype/lohit-gujarati: skipping, looped directory detected /usr/share/fonts/truetype/lohit-kannada: skipping, looped directory detected /usr/share/fonts/truetype/lohit-malayalam: skipping, looped directory detected /usr/share/fonts/truetype/lohit-oriya: skipping, looped directory detected /usr/share/fonts/truetype/lohit-punjabi: skipping, looped directory detected /usr/share/fonts/truetype/lohit-tamil: skipping, looped directory detected /usr/share/fonts/truetype/lohit-tamil-classical: skipping, looped directory detected /usr/share/fonts/truetype/lohit-telugu: skipping, looped directory detected /usr/share/fonts/truetype/lyx: skipping, looped directory detected /usr/share/fonts/truetype/malayalam: skipping, looped directory detected /usr/share/fonts/truetype/nanum: skipping, looped directory detected /usr/share/fonts/truetype/noto: skipping, looped directory detected /usr/share/fonts/truetype/openoffice: skipping, looped directory detected /usr/share/fonts/truetype/padauk: skipping, looped directory detected /usr/share/fonts/truetype/pagul: skipping, looped directory detected /usr/share/fonts/truetype/samyak: skipping, looped directory detected /usr/share/fonts/truetype/samyak-fonts: skipping, looped directory detected /usr/share/fonts/truetype/sinhala: skipping, looped directory detected /usr/share/fonts/truetype/tibetan-machine: skipping, looped directory detected /usr/share/fonts/truetype/tlwg: skipping, looped directory detected /usr/share/fonts/truetype/ttf-bitstream-vera: skipping, looped directory detected /usr/share/fonts/truetype/ttf-khmeros-core: skipping, looped directory detected /usr/share/fonts/truetype/ubuntu: skipping, looped directory detected /usr/share/fonts/type1/urw-base35: skipping, looped directory detected /usr/share/fonts/X11/encodings/large: skipping, looped directory detected /root/anaconda3/var/cache/fontconfig: cleaning cache directory /root/.cache/fontconfig: not cleaning non-existent cache directory /root/.fontconfig: not cleaning non-existent cache directory fc-cache: succeeded --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /tmp/ipykernel_1662/385091406.py in <module> ----> 1 get_font_family() /tmp/ipykernel_1662/3296694249.py in get_font_family() 16 17 import matplotlib as mpl ---> 18 mpl.font_manager._rebuild() 19 findfont = mpl.font_manager.fontManager.findfont 20 mpl.font_manager.findfont = findfont AttributeError: module 'matplotlib.font_manager' has no attribute '_rebuild'
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
주피터 노트북 재시작 할때 코드 실행
안녕하세요. 주피터 노트북 저장할 때 아웃풋들까지 다 저장하는 방법이 있나요? 주피터 노트북 파일을 다시 열면 그 전에 실행했던 것들이 다 사라지는 것 같은데요. 그럼 한줄 한줄 코드를 다시 처음부터 실행해줬다가, 내가 다시 작업하는 부분에 와서 시작해야 되는 건가요? 실무에서도 작업하다가 끄고 다음에 다시 켜서 이어할때 그렇게 코드를 쭉 재실행하고 작업 시작하는지도 궁금합니다.
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
ModuleNotFoundError ....
구글도 찾아보고 선생님이 알려주신 방법도 해봤는대 도저히 안되네요 자세히 알려주시면 감사하겠습니다.
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
그래프에서 과학적 기수법 대신 숫자로 표시하기
그래프에 과학적 기수법 대신 숫자로 나타내는 방법을 구글링해서 아래와 같이 `plt.ticklabel_format`을 추가하였습니다. import matplotlib.pyplot as plt # secondary_y 옵션을 통한 종가와 거래량에 대한 2축 그래프 그리기 stock_daily[["Close", "Volume"]].plot(secondary_y="Volume", figsize=(10, 5)) plt.ticklabel_format(style='plain', axis='y') 여기서 천단위 마다 콤마(,)를 표시할 수 있는 방법이 있을까요? 감사합니다.
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
df["Name"]와 df['Name']의 차이가 어떻게 되나요?
[3/14] Pandas의 Series와 DataFrame 이해와 색인 데이터프레임으로 KRX종목의 Name을 추출할 때 df["Name"] 설명하셨는데요.. df['Name']도 Name이 추출되는데요.. 질문 1. df["Name"]와 df['Name']의 차이가 어떻게 되나요? 2. df['Name']을 사용해도 되지 않나요?
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
TableFixed_tableFrame__1Oq4s TableFixed_scrollFrame__1gp5j 형태의 자료는 어떻게 가져올 수 있나요?
교수님 안녕하십니까? 교수님 강의 너무 잘 듣고 있습니다. 감사드립니다! url과 encoding을 이용해서 html 형식의 자료를 가져오면서 의문이 생겼습니다. 네이버의 외국 증권데이터를 보다가, https://m.stock.naver.com/worldstock/stock/000858.SZ/finance/primary/annual 여기의 경우 자료를 가져올 수 없어, Inspect를 해보니 아래와 같이 나옵니다. 이런 자료는 어떻게 가져올 수 있는지요?
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
그래프 x축 좌측이 아닌 우측에서 시작됩니다.
교수님 안녕하십니까? 수업 잘 듣고 있습니다. 감사드립니다. 다름이 아니고, 4-3 수업을 듣고 있는 그래프들의 x축이 우측에서 시작합니다. 그 이유를 가르쳐주실 수 있으신지요? 감사합니다
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
url 앞에 'f'를 붙이는 것에 대한 의미를 정확히 모르겠습니다.
교수님 안녕하세요? 아래 질문한 학생인데 한 가지 질문이 더 있어서 이렇게 여쭙습니다. url = f"https://finance.naver.com/item/sise_day.naver?code={item_code}&page={page_no}" 에서 'f'를 붙이는 의미를 정확히 이해 못 하겠습니다. 처음에는 그냥 넘어갔는데, 이후에도 몇 번 나와서 여쭙습니다. 감사합니다!
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
fdr에서 미국 주식 종목코드대신 티커(Ticker)를 사용하면 에러가 납니다. 왜 그런가요?
교수님 안녕하세요? 수업 너무 잘 듣고 있는 학생입니다. fdr에서 미국 주식 종목코드대신 티커(Ticker)를 사용하면 에러가 납니다. 왜 그럴까요? ㅠ amd = fdr.DataReader("AMD", "2015", "2021") amd --------------------------------------------------------- --------------------------------------------------------------------------- JSONDecodeError Traceback (most recent call last) ~\anaconda3\lib\site-packages\requests\models.py in json(self, **kwargs) 909 try: --> 910 return complexjson.loads(self.text, **kwargs) 911 except JSONDecodeError as e: ~\anaconda3\lib\json\__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 345 parse_constant is None and object_pairs_hook is None and not kw): --> 346 return _default_decoder.decode(s) 347 if cls is None: ~\anaconda3\lib\json\decoder.py in decode(self, s, _w) 336 """ --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() ~\anaconda3\lib\json\decoder.py in raw_decode(self, s, idx) 354 except StopIteration as err: --> 355 raise JSONDecodeError("Expecting value", s, err.value) from None 356 return obj, end JSONDecodeError: Expecting value: line 1 column 1 (char 0) During handling of the above exception, another exception occurred: JSONDecodeError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_6068/1779725454.py in <module> 4 # amd 5 ----> 6 amd = fdr.DataReader("AMD", "2015", "2021") 7 amd ~\anaconda3\lib\site-packages\FinanceDataReader\data.py in DataReader(symbol, start, end, exchange, data_source) 39 # Investing 40 reader = InvestingDailyReader ---> 41 df = reader(symbol, start, end, exchange, data_source).read() 42 end = min([pd.to_datetime(end), datetime.today()]) 43 while len(df) and df.index[-1] < end: # issues/30 ~\anaconda3\lib\site-packages\FinanceDataReader\investing\data.py in read(self) 60 start_date_str = self.start.strftime('%m/%d/%Y') 61 end_date_str = self.end.strftime('%m/%d/%Y') ---> 62 curr_id = self._get_currid_investing(self.symbol, self.exchange, self.data_source) 63 if not curr_id: 64 raise ValueError("Symbol unsupported or not found") ~\anaconda3\lib\site-packages\FinanceDataReader\investing\data.py in _get_currid_investing(self, symbol, exchange, data_source) 28 } 29 r = requests.post(url, data={'search_text': symbol}, headers=headers) ---> 30 jo = r.json() 31 if len(jo['quotes']) == 0: 32 raise ValueError(f"Symbol('{symbol}') not found") ~\anaconda3\lib\site-packages\requests\models.py in json(self, **kwargs) 915 raise RequestsJSONDecodeError(e.message) 916 else: --> 917 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) 918 919 @property JSONDecodeError: [Errno Expecting value] <!DOCTYPE HTML> <html lang="en-US"> <head> <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <meta name="robots" content="noindex, nofollow" /> <meta name="viewport" content="width=device-width,initial-scale=1" /> <title>Just a moment...</title> <style> html, body {width: 100%; height: 100%; margin: 0; padding: 0;} body {background-color: #ffffff; color: #000000; font-family:-apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Helvetica Neue",Arial, sans-serif; font-size: 16px; line-height: 1.7em;-webkit-font-smoothing: antialiased;} h1 { text-align: center; font-weight:700; margin: 16px 0; font-size: 32px; color:#000000; line-height: 1.25;} p {font-size: 20px; font-weight: 400; margin: 8px 0;} p, .attribution, {text-align: center;} #spinner {margin: 0 auto 30px auto; display: block;} .attribution {margin-top: 32px;} @keyframes fader { 0% {opacity: 0.2;} 50% {opacity: 1.0;} 100% {opacity: 0.2;} } @-webkit-keyframes fader { 0% {opacity: 0.2;} 50% {opacity: 1.0;} 100% {opacity: 0.2;} } #cf-bubbles > .bubbles { animation: fader 1.6s infinite;} #cf-bubbles > .bubbles:nth-child(2) { animation-delay: .2s;} #cf-bubbles > .bubbles:nth-child(3) { animation-delay: .4s;} .bubbles { background-color: #f58220; width:20px; height: 20px; margin:2px; border-radius:100%; display:inline-block; } a { color: #2c7cb0; text-decoration: none; -moz-transition: color 0.15s ease; -o-transition: color 0.15s ease; -webkit-transition: color 0.15s ease; transition: color 0.15s ease; } a:hover{color: #f4a15d} .attribution{font-size: 16px; line-height: 1.5;} .ray_id{display: block; margin-top: 8px;} #cf-wrapper #challenge-form { padding-top:25px; padding-bottom:25px; } #cf-hcaptcha-container { text-align:center;} #cf-hcaptcha-container iframe { display: inline-block;} </style> <meta http-equiv="refresh" content="35"> <script> //<![CDATA[ (function(){ window._cf_chl_opt={ cvId: "2", cType: "non-interactive", cNounce: "32421", cRay: "70a2066eee2252f5", cHash: "a3250cbc257b75f", cUPMDTk: "\/?__cf_chl_tk=4AEdswm23.t_D1Kw4CowdKfl.p2O_4HDm_Fqhdm4tdk-1652346667-0-gaNycGzNCH0", cFPWv: "b", cTTimeMs: "1000", cRq: { ru: "aHR0cHM6Ly9jbi5pbnZlc3RpbmcuY29tLw==", ra: "TW96aWxsYS81LjAgKE1hY2ludG9zaCkgQXBwbGVXZWJLaXQvNTM3LjM2IENocm9tZS85OC4wLjQ3NTguMTA5", rm: "R0VU", d: "IrGXJX8WwxjHXC6SsLCyk5flSLKTkxdpBpn2uRFFjlhGA8FCzv1106INRQFcBCSOcc34UH5nxCxgebdO8IxwHVtQJTP7KekrmViRq1uOINl+AdX/a7i5RtF81mAIjVfGeDs5efiKIHUugONm7di/Xrw8p8JJpQ5ptheMrfDN1MVAnNeUvNeVv9OBWKcGIDbP2k+o7eVU1w7jEiUcPon932rhc5zweSsD5q9de0QkKxsXdTtwDZinxn7yaenlYYyUKTOn6Wt8sAyn09ME+iz+2TuAFvPMEt5eHG5m40pfZDbyah/W2SuEYPdwIZmZDb6Sd6WfuxBrNfJe1UbCbef8R/bjsw/1l0O/3Br3hOzTupONzZEFsiApEyFnaHd2gQWBhx1cbTGslUAYpdbj+micFY2zvAfLMgOHC56YmIFGk+EKEihMkaIuz2o9V0p7tBGsmexvHiBt4pChBoSUidvZ6tD/YQFC6qfBpn5moCRnzw7ngg2KtreyKZ540WXrUrrJQJG4w6A7kGJXbGy/YdLm8V3l8lSWhu1sfZiHBxiHPBDmyV9WzYbBUz/vGxNVlx3A9XcUsUE6KtZo8ITJWVvgnjvbbufQ1XMr3H4pbPDDtX4=", t: "MTY1MjM0NjY2Ny4zNTkwMDA=", m: "w8fUFTCnxEtk0fB7RJyyNGcBwOGo18NG04QMYvJ3GdE=", i1: "2nPfOKusxCugpSkSIFoqHQ==", i2: "n23pckyYeUXKbesrZe6pow==", zh: "JJQg2KI/+bPgJbLHlLjmrs/mnno8aAGH5k3tm8QDk4c=", uh: "POxlFgDekQG5h9Kd7TiU8+U9MUspCK9r8ctlJLyBZWY=", hh: "T2hi97JJ3TXBbbaDfe4fVaGfimFjucUPtz+gmsc9Zq0=", } } window._cf_chl_enter = function(){window._cf_chl_opt.p=1}; })(); //]]> </script> </head> <body> <table width="100%" height="100%" cellpadding="20"> <tr> <td align="center" valign="middle"> <div class="cf-browser-verification cf-im-under-attack"> <noscript> <h1 data-translate="turn_on_js" style="color:#bd2426;">Please turn JavaScript on and reload the page.</h1> </noscript> <div id="cf-content" style="display:none"> <div id="cf-bubbles"> <div class="bubbles"></div> <div class="bubbles"></div> <div class="bubbles"></div> </div> <h1><span data-translate="checking_browser">Checking your browser before accessing</span> cn.investing.com.</h1> <div id="no-cookie-warning" class="cookie-warning" data-translate="turn_on_cookies" style="display:none"> <p data-translate="turn_on_cookies" style="color:#bd2426;">Please enable Cookies and reload the page.</p> </div> <p data-translate="process_is_automatic">This process is automatic. Your browser will redirect to your requested content shortly.</p> <p data-translate="allow_5_secs" id="cf-spinner-allow-5-secs" >Please allow up to 5 seconds…</p> <p data-translate="redirecting" id="cf-spinner-redirecting" style="display:none">Redirecting…</p> </div> <form class="challenge-form" id="challenge-form" action="/?__cf_chl_f_tk=4AEdswm23.t_D1Kw4CowdKfl.p2O_4HDm_Fqhdm4tdk-1652346667-0-gaNycGzNCH0" method="POST" enctype="application/x-www-form-urlencoded"> <input type="hidden" name="md" value="7F11XeMx.ejOcm5oKagE6vMFVK_j.Pz2FIc0swxinqE-1652346667-0-AUybo4Ro0l1qXkmJ1DkI4qZxcjJTXb_JroUhYqMxz1IHsItTMBcl2SvE-Nwc4YHtH3aCMgTLJZWSB6iWaoUAX7Dmord_nj_y6po-kTqWq_7k1ucnDXpezv_jWsMqMtHSHvWQRx_f0KsYCu83UyAyJtz8xLKqwRREZuC0gjQydYhL9JjSVGkuSvaZ4VyOq3bLZPSfEfkw_yI164lnskD2Qcyv6qZmidWqUks3762SXA-D6ZDzp_hV5X5IdoelmjhxzUg1o9hVZ0-IJufOEtCUdN2dAocVEM_DEHm4AA77bfTIbaefwd3Ss170zUJxGFYm4rcwTtuF1zYbnyDwuUNg0ljsQoQNnO0D0hcHZv03_F992D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19rdHqvEDUjKouMn+gd8aSzNXwjkl2L/ucvMhL01EE5CVF+d0uG0MaYMzHzRxPGVSuGmjkV+lpZTneaT6eX+785U4ENAuW+dMaMfGWMg29jrNXkLi//dwN9JrzDk2xVe6sL7fHX26PBtAvpcyiOIH0eN83kZmWx1OejsnI7kO3u2i0JW1q+c/iTIFlf9EB2njxWsdGJ0Yc27/Tv873vnepzUcExiLeRm4KfV5Ba8E6Qmns6M6pR7Cn0H5CkIEA492PidHGZHNpuhc0NBtn/yT7dUsi9UAMG4vyQxywXyEytPJzseSvkCFP/aZLK99xTE1wsQkaAYl9aPg59eLuaKmE/saNL2YZkoJwOA=="/> <input type="hidden" value="2a8239f20bf11282609a7a5d0fb900d6" id="jschl-vc" name="jschl_vc"/> <!-- <input type="hidden" value="" id="jschl-vc" name="jschl_vc"/> --> <input type="hidden" name="pass" value="1652346668.359-GRitOVYXok"/> <input type="hidden" id="jschl-answer" name="jschl_answer"/> </form> <script> //<![CDATA[ (function(){ var a = document.getElementById('cf-content'); a.style.display = 'block'; var isIE = /(MSIE|Trident\/|Edge\/)/i.test(window.navigator.userAgent); var trkjs = isIE ? new Image() : document.createElement('img'); trkjs.setAttribute("src", "/cdn-cgi/images/trace/jschal/js/transparent.gif?ray=70a2066eee2252f5"); trkjs.id = "trk_jschal_js"; trkjs.setAttribute("alt", ""); document.body.appendChild(trkjs); var cpo=document.createElement('script'); cpo.type='text/javascript'; cpo.src="/cdn-cgi/challenge-platform/h/b/orchestrate/jsch/v1?ray=70a2066eee2252f5"; window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash; window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, -window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search; if (window._cf_chl_opt.cUPMDTk && window.history && window.history.replaceState) { var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash; history.replaceState(null, null, "\/?__cf_chl_rt_tk=4AEdswm23.t_D1Kw4CowdKfl.p2O_4HDm_Fqhdm4tdk-1652346667-0-gaNycGzNCH0" + window._cf_chl_opt.cOgUHash); cpo.onload = function() { history.replaceState(null, null, ogU); }; } document.getElementsByTagName('head')[0].appendChild(cpo); }()); //]]> </script> <div id="trk_jschal_nojs" style="background-image:url('/cdn-cgi/images/trace/jschal/nojs/transparent.gif?ray=70a2066eee2252f5')"> </div> </div> <div class="attribution"> DDoS protection by <a rel="noopener noreferrer" href="https://www.cloudflare.com/5xx-error-landing/" target="_blank">Cloudflare</a> <br /> <span class="ray_id">Ray ID: <code>70a2066eee2252f5</code></span> </div> </td> </tr> </table> </body> </html> : 0
- 해결됨파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
dataframe 접근속도 관련 문의
유튜브 보다 인프런 강의까지 오게되었는데 듣다 궁금한 부분이 있어서 질문드립니다. %timeit을 해서 확인해보니 1) df["Name"][0] 2) df.loc[0."Name"] 3) df.loc[0]["Name"] - 유튜브에서는 1)과 2)를 비교해주셨고, - 인프런에서는 2)와 3)을 비교해주시면서 2)가 접근속도가 더 빠르다고 하였는데 1)이 가장 빠르다고 나와서 이에 대한 다른 이유?가 있는지 궁금해서 문의드립니다.
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
beautiful soup과 request 라이브러리의 관례
강사님~! 다른 곳에서 bs4이 selenium과 사용되는 것도 본 적이 있습니다, 여가 강의에서는 request 라이브러리랑 함께 쓰였는데, beautiful soup는 꼭 request 라이브러리랑만 쓰이는 것은 아닌 건가요?~ 그리고 from bs4 import BeautifulSoup 으로만도 쓰이는 것을 봤는데, 그렇다면 from bs4 import BeautifulSoup as bs의 차이도 궁금합니다.
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
requests.get()과 driver.get()의 차이가 궁금합니다.
웹 크롤링을 할 때, 두 가지 경우 모두 작동이 되는데, 그렇다면, requests.get()과 driver.get()의 차이가 궁금합니다. response = requests.get(bs_url ) response = driver.get(bs_url)]
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
실습 소스코드 섹션0의 수업자료 다운로드 어디서 받나요?
실습 소스코드 섹션0의 수업자료 다운로드 어디서 받나요? 제가 바보라서 어디서 찾는지 모르겠어요. 수업을 순서대로 안 들어서 못 찾는거 같은데 알려주세요. 깃허브에 있는 걸 얘기하는건지..... 도와주세요 ㅠ.ㅠ
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
plotly 수업예제 일별 수익률 선그래프 그리기
안녕하세요. 강사님! 3.4 plotly로 일별 시세 시각화 수업을 이제 막 듣고 있는데, 아래 스크린샷한 것과 같은 문제가 있었습니다. 아래와 같이 방법을 시도해 보았습니다. 1.pip install plotly --upgrade 2.pip install --upgrade nbformat 3. conda install -c conda-forge nbformat 전부 정상적으로 셋팅된것 같은데, 작동이 안되네요. 물론 커널도 새로 시작하였구요. 저의 작업 환경은 macOS monterey version12.2 apple M1 chip visual studio code 1.63.2 python 3.8.12 입니다. 조언 부탁드립니다. 감사합니다.
- 미해결파이썬 증권 데이터 수집과 분석으로 신호와 소음 찾기
수염의 길이
안녕하세요. 강의 잘 듣고 있습니다, 강의랑 위키백과에서 수염의 길이는 색칠된 부분의 1.5배에 각각 Q2에서는 빼주고 Q3에서는 더해준다고 나와있습니다. 그러면 수염의 길이는 같다고 생각했고, 대부분은 그런 형태로 나와 있는데 몇몇 그래프는 아닌게 있더라고요. 이건 왜그런가요?