본문 바로가기

전체 글227

python txt파일 읽기 에러 'cp949' UnicodeDecodeError: 'cp949' codec can't decode bytes in position : illegal multibyte sequence python3 부터는 ANSI 기준으로 작성된 파일만 읽을 수 있다. UTF-8로 작성된 파일은 보통 방법으로 읽을 때 에러가 난다. 2가지 방법이 있다. 1. utf-8을 붙여준다. f = open( "text.txt", "r", "utf-8" ) 2. 파일의 인코딩을 ANSI로 바꾸면 된다.해당 파일을 메모장으로 열었을 경우 [다른 이름으로 저장]에서 가능하다.밑에 보면 나와있다. 인코딩: ~~ 2014. 12. 19.
sklearn.cross_validation.train_test_split(*arrays, **options) sklearn.cross_validation.train_test_split(*arrays, **options) 함수는배열 또는 매트릭스를 랜덤하게 트레인과 테스트 셋으로 나눈다. 사용법: Split into training and test set (e.g., 80/20) 80대 20으로 나눈다. from sklearn.cross_validation import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0) Examples>>>>>> import numpy as np >>> from sklearn.cross_validation import train_test_spl.. 2014. 12. 19.
[error] AttributeError: 'module' object has no attribute 'cluster' from sklearn.cluster import KMeans kmeans 알고리즘을 사용하려고 하려고 scikit-learn, numpy 모듈 등을 설치했는데도다음과 같은 에러가 났을 때 AttributeError: 'module' object has no attribute 'cluster' scikit-learn 을 설치할 때 잘 보면 Scikit-learn integrates classic machine learning algorithms. Requires numpy-mkl. 다음과 같은 설명을 볼 수 있다. numpy-mkl모듈도 함께 설치해야 한다~! 2014. 12. 19.
mac에 python, opencv 설치 하루종일 에러 검사하고... 구글링.. 구글링...ㅠㅜ 결국 전체 다! 지우고 다시 설치 했다.. python에 import cv2, opencv 설치하기 in mac 먼저 에러가 난다면, 환경설정이나 뭐든.. 일단 다 지우고 새로운 마음으로 한다. (설치했던 라이브러리도 다 지워진다. but don't worry 다시 설치하면 된다)* 지우는 방법 1. python 2.7 framework를 지운다. sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7 2. 어플리케이션 폴더를 지운다. sudo rm -rf "/Applications/Python 2.7" 3. 심볼릭 링크를 다 지운다. ls -l /usr/local/bin | grep '../L.. 2014. 12. 19.
반응형