파이썬(55)
-
[5주차 - Day3] Django로 동적 웹 페이지 만들기
#models.py from django.db import models class.Coffee(models.Model) name = models.Charfield(default="", max_length=25) price = models.IntegerField(default=0) is_ice = models.BooleanField(default=False) 장고에 커피를 추가하고, 그 안에 name, price, is_ice를 추가합니다. #admin.py from django.contrib import admin from .models import Coffee admin.site.register(Coffee) class (models.Model): name = models.CharType() price..
2023.05.11 -
[3주차 - Day5] Python으로 시각화 프로젝트
* 데이터 출처: https://www.kaggle.com/shivamb/netflix-shows import pandas as pd import os # os.environ을 이용하여 Kaggle API Username, Key 세팅하기 os.environ['KAGGLE_USERNAME'] = 'jhighllight' os.environ['KAGGLE_KEY'] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx' # Linux 명령어로 Kaggle API를 이용하여 데이터셋 다운로드하기 (!kaggle ~) # Linux 명령어로 압축 해제하기 !kaggle datasets download -d shivamb/netflix-shows !unzip '*.zip' netflix-shows.zip: S..
2023.04.01 -
[3주차 - Day3] Python으로 데이터 다루기 - Pandas
Pandas 시작하기 Import pandas를 통해서 진행 import pandas as pd pandas로 1차원 데이터 다루기 - Series Series? 1-D labled array 인덱스를 지정해 줄 수 있음 s = pd.Series([1, 4, 9, 16, 25]) s 0 1 1 4 2 9 3 16 4 25 dtype: int64 t = pd.Series({'one':1, 'two':2, 'three':3, 'four':4, 'five':5}) t one 1 two 2 three 3 four 4 five 5 dtype: int64 Series + Numpy Series는 ndarrayd와 유사하다 s[1] 4 t[1] 2 t[1:3] two 2 three 3 dtype: int64 s[s ..
2023.03.31 -
[3주차 DAY02] Numpy 실습
numpy 실습 지뢰 찾기 board는 10 x 10 크기를 가진 2차원의 행렬로 되어있고, 다음과 같이 동등한 크기 5 x 5를 가진 4개의 구역으로 나뉩니다. board의 각 구역마다 지뢰를 제거해야 합니다. 지뢰는 bomb1, bomb2, bomb3, bomb4 총 4개의 종류가 있으며 각 구역에서 제거해야 될 지뢰종류가 다릅니다. 1 구역에서는 bomb1에 해당하는 요소만 제거합니다. 2 구역에서는 bomb2에 해당하는 요소만 제거합니다. 3 구역에서는 bomb3에 해당하는 요소만 제거합니다. 4 구역에서는 bomb4에 해당하는 요소만 제거합니다. bomb1, bomb2, bomb3, bomb4는 bombs에 차례대로 담겨 1차원 배열로 주어지고, 지뢰로 판단되는 요소를 0으로 변경하면 지뢰는 제..
2023.03.30 -
[2주차 - Day4] 시각화로 결과 요약하기 - Seaborn
시각화 라이브러리, Seaborn Seaborn matplotlib을 기반으로 하는 시각화 라이브러리 import seaborn as sns tips = sns.load_dataset("tips") sns.relplot( data=tips, x="total_bill", y="tip", col="time", hue="smoker", style="smoker", size="size", ) 다양한 그래프를 고수준(high-level)에서 쉽게 그릴 수 있습니다. 스크래핑 결과 시각화하기 1 - Web Scraping 기초 %pip install selenium %pip install webdriver_manager Requirement already satisfied: selenium in ./opt/ana..
2023.03.24 -
Part1. Chapter 05 - 미국의 대통령은 어떻게 뽑힐까
Step 1. 데이터셋 준비하기 !pip install geopandas !pip install pyshp !pip install shapely !pip install plotly-geo Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/ Collecting geopandas Downloading geopandas-0.12.2-py3-none-any.whl (1.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 13.4 MB/s eta 0:00:00 Requirement already satisfied: shapely>=1.7 ..
2023.03.22