파이썬

파이썬/Numpy

[Numby]Numpy 소수점 표현에서 e 안보이게 하기

1. 출처 https://numpy.org/doc/stable/reference/generated/numpy.set_printoptions.html numpy.set_printoptions — NumPy v1.25 Manual If True, always print floating point numbers using fixed point notation, in which case numbers equal to zero in the current precision will print as zero. If False, then scientific notation is used when absolute value of the smallest number is < 1e-4 or the numpy.org 2. 코..

파이썬/matplotlib

[Python] Matplotlib Mac, Window 한글 깨짐

import matplotlib # windows의 경우 matplotlib.rcParams['font.family'] = 'Malgun Gothic' # mac의 경우 matplotlib.rcParams['font.family'] = 'AppleGothic' 다음의 코드를 운영체제에 맞게 실행해주면 해결된다.

파이썬/Pandas

[Python] Pandas mean Error(TypeError)

1. 문제 판다스를 2.0.0 으로 업그레이드 하고 다음과 같은 오류가 발생 하였다. df = pd.DataFrame([['a',1],['b',1]])df.mean() df.mean() --------------------------------------------------------------------------- ValueError Traceback (most recent call last) File /opt/homebrew/Caskroom/miniconda/base/envs/test2/lib/python3.9/site-packages/pandas/core/nanops.py:1680, in _ensure_numeric(x) 1679 try: -> 1680 x = x.astype(np.complex..

파이썬/Selenium

[Selenium] StaleElementReferenceException

1. 오류 코드 중 게시판에서 다음 페이지로 넘어가는 것을 클릭하여 페이지 이동 후 미리 저장한 변수를 사용 했을 때 StaleElementReferenceException 오류가 발생 하였다... 처음에는 페이지 불러오기 전에 사용한 것만이 문제이줄 알았지만 , 그것과 미리 저장한 element 사용이 문제 였다. def set_href_list(self): # 페이지 1 -> 3 까지 page_num = 0 while page_num < 3: self.page_list[page_num].send_keys('\n') self.driver.implicitly_wait(5) time.sleep(2) if page_num

파이썬/Numpy

[Python] AttributeError: 'NoneType' object has no attribute 'split'

1. 증상 Numpy 와 Kmeans를 같이 사용하면 다음과 같은 오류가 발생하였다.. import numpy as np from sklearn.cluster import KMeans allLocations = np.array([[1, 2], [1, 4], [1, 0], [10, 2], [10, 4], [10, 0]]) kmeanModel = KMeans(n_clusters=2, random_state=0) kmeanModel.fit(allLocations) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[40], l..

파이썬/Tensorflow

RNN_주식 예측

RNN 을 사용하여 시계열 데이터인 주식을 예측 해보자 import pandas as pd import matplotlib.pyplot as plt # 테스트 데이터와 트레인 데이터 홀드 아웃 할 때 사용하는 함수 from sklearn.model_selection import train_test_split import tensorflow as tf from tensorflow.keras import models from tensorflow.keras import layers from tensorflow.keras.models import Model import sklearn as sns # 사용할 변수 정의 batch_size = 100 path = "/content/drive/MyDrive/Tenso..

파이썬/matplotlib

Colab 에서 Matplotlib 폰트 깨짐(추가:AttributeError: module 'matplotlib.font_manager' has no attribute 'rebuild')

1. 문제 Matplotlib을 이용하여 그래프를 그리는 도중 다음과 같은 오류 발생 2. 원인 한글 폰트를 설정해 주지 않았기 때문에 "로멘스" 등 한국어가 깨져서 나오는 것 이다. 3. 해결법 # 폰트 설치 및 런타임 종료 #import matplotlib.font_manager as fm #import os # apt-get : 패키지 설치 명령어 # -qq : 에러외의 메세지 숨기는 옵션 #!apt-get -qq install fonts-nanum # font_manager 리빌드 #fm._rebuild() # colab 연결 종료 #os.kill(os.getpid(), 9) 위 의 코드를 실행 후 다음의 코드를 실행해준다. # 폰트 설정 #import matplotlib.pyplot as plt..

easysheep
'파이썬' 카테고리의 글 목록