pickle (2) 썸네일형 리스트형 [머신러닝ML]모델 파일 저장 및 불러오기 1. 와인데이터 불러들이기 2. 랜덤포레스트로 훈련까지(fit)만 수행하기 라이브러리 """데이터 처리""" import pandas as pd import numpy as np """데이터 분류""" from sklearn.model_selection import train_test_split """하이퍼파라메터 튜닝""" from sklearn.model_selection import GridSearchCV """사용할 분류모델들""" from sklearn.ensemble import RandomForestClassifier from sklearn.ensemble import ExtraTreesClassifier from sklearn.ensemble import GradientBoostingCla.. [Python][파이썬] 파일 생성하기, pickle 모듈 1. 파일 생성하기 # w : 쓰기모드(텍스트 모드) f = open('foo.txt', 'w') f.write('Life is to short \n') f.write('Life is to short1 \n') f.write('Life is to short2 \n') f.close() 결과 foo.txt파일 생성 # r : 읽기모드(텍스트 모드) f = open('foo.txt', 'r') f.readline() f.close() ※ readline()을 사용해서 파일의 첫 번째 줄을 읽어 출력 ※ 파일 open과 close 반드시 사용해야함!! 결과 'Life is to short \n' 파일열기모드 설명 r 읽기 모드 : 파일을 읽기만 할 때 사용한다. w 쓰기 모드 : 파일에 내용을 쓸 때 사용한다.. 이전 1 다음