본문 바로가기
반응형

Python52

변수와 자료형 변수: 필요한 자료를 일시적으로 보관하거나 처리 결과를 담을 수 있는 기억장소 역할 변수명 작성 규칙 1. 의미를 파악할 수 있는 이름으로 지정하는 것이 좋다. 2. 첫 자는 영문자로 시작한다. 3. 공백이나 특수문자는 사용하지 않는다. 4. 예약어는 사용할 수 없다. 5. 두 번째 단어는 숫자, under bar(_)를 사용할 수 있다. 6. 대문자와 소문자는 서로 다른 변수로 인식한다. (대소문자 구분) 변수와 메모리 주소(address) var1 = "Hello python" print(var1) print(id(var1)) Hello python 67239512 var1 = 100 print(var1) print(id(var1)) 100 1850632928 var2 = 150.25 print(va.. 2023. 2. 21.
DACON Python 튜토리얼 Lv4. 교차검증과 모델 앙상블을 활용한 와인 품질 분류하기 데이터 다운로드 # 데이터 다운로드 링크로 데이터를 코랩에 불러옵니다. !wget 'https://bit.ly/3i4n1QB' import zipfile with zipfile.ZipFile('3i4n1QB', 'r') as existing_zip: existing_zip.extractall('data') # 라이브러리 및 데이터 불러오기 import pandas as pd from sklearn.preprocessing import MinMaxScaler, OneHotEncoder, PolynomialFeatures from lightgbm import LGBMClassifier from xgboost import XGBClassifier from sklearn.ensemble import Random.. 2023. 1. 19.
DACON Python 튜토리얼 Lv3. 교차검증과 LGBM 모델을 활용한 와인 품질 분류하기 EDA !wget 'https://bit.ly/3i4n1QB' import zipfile with zipfile.ZipFile('3i4n1QB', 'r') as existing_zip: existing_zip.extractall('data') import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt import seaborn as sns # read_csv() 매서드로 train.csv , test.csv파일을 df class 로 불러오세요. train = pd.read_csv('data/train.csv') test = pd.read_csv('data/test.csv') # info() 매서드로 데이터.. 2023. 1. 16.
프로그래밍 시작하기: 파이썬 입문(Inflearn Original) Project Hangman(행맨) 미니 게임 제작(1) # 기본 프로그램 제작 및 테스트 import time # 처음 인사 name = input("What is your name?") print("Hi, " + name, "Time to play hangman game!") print() time. sleep(1) print("Start Loading...") print() time.sleep(0.5) # 정답 단어 word = "secret" # 추측 단어 guesses = '' # 기회 turns = 10 # 핵심 While Loop # 찬스 카운트가 남아 있을 경우 while turns > 0: # 실패 횟수 failed = 0 # 정답 단어 반복 for char in word: # 정답 단어 내에 추측 문.. 2023. 1. 15.
DACON Python 튜토리얼 Lv2. 결측치 보간법과 랜덤포레스트로 따릉이 데이터 예측하기 데이터 다운로드 # 데이터 다운로드 링크로 데이터를 코랩에 불러옵니다. !wget 'https://bit.ly/3gLj0Q6' import zipfile with zipfile.ZipFile('3gLj0Q6', 'r') as existing_zip: existing_zip.extractall('data') --2023-01-12 03:54:03-- https://bit.ly/3gLj0Q6 Resolving bit.ly (bit.ly)... 67.199.248.10, 67.199.248.11 Connecting to bit.ly (bit.ly)|67.199.248.10|:443... connected. HTTP request sent, awaiting response... 301 Moved Permanen.. 2023. 1. 12.
DACON Python 튜토리얼 Lv1. 의사결정회귀나무로 따릉이 데이터 예측하기 데이터 다운로드 # 데이터 다운로드 링크로 데이터를 코랩에 불러옵니다. !wget 'https://bit.ly/3gLj0Q6' import zipfile with zipfile.ZipFile('3gLj0Q6', 'r') as existing_zip: existing_zip.extractall('data') --2023-01-11 08:15:16-- https://bit.ly/3gLj0Q6 Resolving bit.ly (bit.ly)... 67.199.248.11, 67.199.248.10 Connecting to bit.ly (bit.ly)|67.199.248.11|:443... connected. HTTP request sent, awaiting response... 301 Moved Permanen.. 2023. 1. 11.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter13 텍스트 마이닝 01 [감성 분석 + 토픽 모델링] 영화 리뷰 데이터로 감성 예측하기 데이터 준비 및 탐색 pandas 버전 확인하기 import pandas as pd pd.show_versions() INSTALLED VERSIONS ------------------ commit : 66e3805b8cabe977f40c05259cc3fcf7ead5687d python : 3.8.16.final.0 python-bits : 64 OS : Linux OS-release : 5.10.147+ Version : #1 SMP Sat Dec 10 16:00:40 UTC 2022 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UT.. 2023. 1. 11.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter12 군집분석 01 [평균 군집화 분석 + 그래프] 타깃 마케팅을 위한 소비자 군집 분석하기 import pandas as pd import math retail_df = pd.read_excel('/content/Online_Retail.xlsx') retail_df.head() 데이터 정제하기 retail_df.info() Int64Index: 536641 entries, 0 to 541908 Data columns (total 8 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 InvoiceNo 536641 non-null object 1 StockCode 536641 non-null object 2 Description 5351.. 2023. 1. 10.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter11 분류 분석 01 [로지스틱 회귀 분석] 특징 데이터로 유방암 진단하기 사이킷런 의 유방암 진단 데이터셋 사용하기 import numpy as np import pandas as pd from sklearn.datasets import load_breast_cancer b_cancer = load_breast_cancer() print(b_cancer.DESCR) .. _breast_cancer_dataset: Breast cancer wisconsin (diagnostic) dataset -------------------------------------------- **Data Set Characteristics:** :Number of Instances: 569 :Number of Attributes: 30 n.. 2023. 1. 10.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter10 회귀 분석 01 [선형 회귀 분석 + 산점도/선형 회귀 그래프] 환경에 따른 주택 가격 예측하기 !pip install sklearn Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/ Collecting sklearn Downloading sklearn-0.0.post1.tar.gz (3.6 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: sklearn Building wheel for sklearn (setup.py) ... done Created wheel for sklearn: file.. 2023. 1. 9.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter09 지리 정보 분석 01 [주소 데이터 분석 + 지오맵] 지리 정보 분석 후 맵 생성하기 import pandas as pd CB = pd.read_csv('CoffeeBean.csv', encoding = 'CP949', index_col = 0, header = 0, engine = 'python') CB.head() #작업 내용 확인용 출력 addr = [] for address in CB.address: addr.append(str(address).split()) addr #작업 내용 확인용 출력 [['서울시', '강남구', '학동로', '211', '1층'], ['서울시', '강남구', '광평로', '280', '수서동', '724호'], ['서울시', '강남구', '논현로', '566', '강남차병원1층'], [.. 2023. 1. 9.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter08 텍스트 빈도 분석 01 [영문 분석 + 워드클라우드] 영문 문서 제목의 키워드 분석하기 !pip install matplotlib !pip install wordcloud !pip install nltk Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/ Requirement already satisfied: matplotlib in /usr/local/lib/python3.8/dist-packages (3.2.2) Requirement already satisfied: numpy>=1.11 in /usr/local/lib/python3.8/dist-packages (from matplotlib) .. 2023. 1. 8.
반응형