개요 pandas 데이터프레임의 여러 개체 유형(문자열) 열에서 고유 값을 조사하려면 해당 열을 선택한 다음 unique()를 적용하여 고유 값을 추출한다. 이를 위한 단계별 접근 방식은 다음과 같다. 1단계 : 여러 컬럼 중에서 문자열 컬럼만 추출한다. 2단계 : unique() 함수를 활용하여 unique()값만 가져온다. 3단계 : 결괏값은 dictionary 형태로 담는다. 가상 데이터 생성 임의의 가상 데이터를 생성한다. import pandas as pd data = { 'Name': ['Evan', 'Bob', 'Evan', 'Bob'], 'City': ['New York', 'Los Angeles', 'New York', 'SF'], 'Job': ['Engineer', 'Engineer', 'Engineer', 'Artist'], 'num1' : [1, 2, 3, 4] } df = pd.
개요 작업 2유형(머신러닝)을 보다 쉽게 대비할 수 있도록 튜토리얼을 준비했습니다. 핵심 키워드 : Python 머신러닝은 pipeline 코드로 기억하자 본 코드는 구글 코랩에서 작성하였습니다. 유투브 유투브에서 강의 영상을 시청할 수 있습니다. (구독과 좋아요) 데이터 출처 본 데이터는 K-Data에서 가져왔습니다. 구글 드라이브 연동 데이터를 가져오기 위해 구글 드라이브와 연동합니다. from google.colab import drive drive.mount("/content/drive") Mounted at /content/drive 라이브러리 불러오기 아래 라이브러리들을 모두 암기하시기를 바랍니다. import pandas as pd import numpy as np from sklearn.
개요 Python 설치 과정을 유투브로 정리하였습니다. 본 튜토리얼은 Streamlit으로 프로젝트 한방에 끝내기 with 파이썬(2023, Sara & Evan) 교재를 동영상으로 변환하는 작업의 일환입니다. 유투브
개요 M1에서 Python 환경설정을 해본다. XGBoost & LightGBM 및 Streamlit 설치를 진행한다. 아나콘다 설치 m1 버전의 아나콘다를 설치한다. 깃헙 레포 생성 먼저 github repo를 생성한다. Conda 가상환경 설정 git clone 명령어를 통해 repo를 로컬로 다운로드 한다. evan$ git clone https://github.com/yourname/m1_streamlit.git Cloning into 'm1_streamlit'... remote: Enumerating objects: 4, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (3/3), done. remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0 Receiving objects: 100% (4/4), done.
현상 plotly 라이브러리를 활용하여 Google Colab에서 시각화를 할 때 그래프가 보이지 않는 현상이 존재함 여러 방법론이 등장하지만, 공식문서에 따라서 어떻게 활용하는지 확인하도록 함 Google Colab 먼저 구글 코랩에서 간단한 시각화 코드를 작성하고 코드를 실행한다. import plotly plotly.__version__ # 5.13.1 샘플 코드는 아래와 같음 import plotly.graph_objects as go import pandas as pd temp = pd.DataFrame({ "Fruit": ["Apples", "Oranges", "Bananas", "Apples", "Oranges", "Bananas"], "Contestant": ["Alex", "Alex", "Alex", "Jordan", "Jordan", "Jordan"], "Number Eaten": [2, 1, 3, 1, 3, 2], }) fig = go.
개요 이번에는 Scrapy를 통해서 다중 페이지를 크롤링 하도록 한다. Target 페이지 타겟 웹사이트 : https://www.audible.com/search 프로젝트 시작 프로젝트 시작은 다음과 같이 할 수 있다. $ scrapy startproject multiCam_tutorial New Scrapy project 'multiCam_tutorial', using template directory 'C:\Users\j2hoo\OneDrive\Desktop\your_project_folder\venv\Lib\site-packages\scrapy\templates\project', created in: C:\Users\j2hoo\OneDrive\Desktop\your_path\multiCam_tutorial You can start your first spider with: cd multiCam_tutorial scrapy genspider example example.com 해당 multiCam_tutorial 경로에서 다음 명령어를 실행하여 타겟 사이트를 설정한다. $ scrapy genspider audible www.audible.com/search Created spider 'audible' using template 'basic' in module: multiCam_tutorial.
개요 Scrapy Tutorial 설치 과정 및 기본 크롤링 과정을 살펴본다. 라이브러리 설치 라이브러리 설치는 다음과 같다. pip install scrapy 프로젝트 시작 Django와 비슷하게 터미널 명령어는 startproject라고 입력한다. $ scrapy startproject multiCam_tutorial New Scrapy project 'multiCam_tutorial', using template directory 'C:\Users\j2hoo\OneDrive\Desktop\your_project_folder\venv\Lib\site-packages\scrapy\templates\project', created in: C:\Users\j2hoo\OneDrive\Desktop\your_path\multiCam_tutorial You can start your first spider with: cd multiCam_tutorial scrapy genspider example example.com 파일 구조는 아래와 같이 여러개의 파일로 구성되었다. 타겟 주소는 아래와 같다. 주소 : https://www.worldometers.info/world-population/population-by-country/ $ scrapy genspider worldometer www.
개요 Django 한 그릇 뚝딱 교재의 내용에서 멀티캠퍼스 강의에 맞게 일부 수정함 2019년 버전이고 현재는 2023년이기 때문에 소스코드 변경 사항이 필요할 거 같아서 글을 남김 교재 홍보 교재 구매 : https://www.yes24.com/Product/Goods/83568594 Step 01 - 이전 글 1편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_1/ 2편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_2/ 3편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_3/ 4편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_4/ 5편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_5/ 6편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_6/ Step 02 - 프로젝트 완성하기 지금까지 구현한 기능과 미완료된 기능을 확인한다. Step 03 - 로그인 실패 시 보이는 화면을 구현 우선 사용자가 로그인 실패 시, 보이는 화면으로 구현한다.
개요 Django 한 그릇 뚝딱 교재의 내용에서 멀티캠퍼스 강의에 맞게 일부 수정함 2019년 버전이고 현재는 2023년이기 때문에 소스코드 변경 사항이 필요할 거 같아서 글을 남김 교재 홍보 교재 구매 : https://www.yes24.com/Product/Goods/83568594 Step 01 - 이전 글 1편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_1/ 2편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_2/ 3편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_3/ 4편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_4/ 5편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_5/ Step 02 - 프로젝트 완성하기 지금까지 구현한 기능과 미완료된 기능을 확인한다. Step 03 - 엑셀 결과 화면 출력 위한 세션값 저장 우선 calculate 함수의 마지막에 엑셀 결과 화면으로 데이터와 함께 url을 이동시켜본다.
개요 Django 한 그릇 뚝딱 교재의 내용에서 멀티캠퍼스 강의에 맞게 일부 수정함 2019년 버전이고 현재는 2023년이기 때문에 소스코드 변경 사항이 필요할 거 같아서 글을 남김 교재 홍보 교재 구매 : https://www.yes24.com/Product/Goods/83568594 Step 01 - 이전 글 1편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_1/ 2편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_2/ 3편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_3/ 4편 : https://dschloe.github.io/python/2023/08/django_excel_calculator_4/ Step 02 - 파일 업로드 하기 로그인을 통해 메인 화면으로 왔다면, 파일 업로드 기능 구현 Step 03 - 파일 업로드 기능 구현 check - 1 : index.