본문 바로가기

Python_Intermediate

(155)
[알고리즘]선택 정렬(Select Sort) 선택 정렬> 다음과 같은 순서를 반복하며 정렬하는 알고리즘 1. 주어진 데이터 중, 최소값을 찾음 2. 해당 최소값을 데이터 맨 앞에 위치한 값과 교체함 3. 맨 앞의 위치를 뺀 나머지 데이터를 동일한 방법으로 반복함 참조 사이트> https://visualgo.net/bn/sorting VisuAlgo - Sorting (Bubble, Selection, Insertion, Merge, Quick, Counting, Radix) VisuAlgo is free of charge for Computer Science community on earth. If you like VisuAlgo, the only payment that we ask of you is for you to tell the existe..
[알고리즘]버블 정렬(Buble Sort) 버블 정렬> 두 인접한 데이터를 비교해서, 앞에 있는 데이터가 뒤에 잇는 데이터보다 크면, 자리를 바꾸는 정렬 알고리즘 참조 사이트> https://visualgo.net/bn/sorting VisuAlgo - Sorting (Bubble, Selection, Insertion, Merge, Quick, Counting, Radix) VisuAlgo is free of charge for Computer Science community on earth. If you like VisuAlgo, the only payment that we ask of you is for you to tell the existence of VisuAlgo to other Computer Science students/inst..
[Font]To confirm the font English name( 폰트 영문 이름 확인) Matplotlib 사용 시 한글을 사용할 시 글씨가 깨지는 문제가 있다. 전역 변수를 사용하여 폰트를 지정해주기도 하는데 이때 영문 이름을 사용한다. 이것을 확인 하기 위해 일부 코드를 작성해서 폰트에 영문 이름을 확인 해본다. 1. 필요 모듈 import os import sys from matplotlib import font_manager 2. 시스템 폴더 스캔 - Windows c:\windows\fonts - MAC OS /users/계정명/library/Fonts - Python 적용 font_manager._rebuild() 3. Windows - Code if sys.platform == 'win32': font_list = font_manager.findSystemFonts() font..
[EXCEL]Excel File Data Analysis(엑셀 파일 Pandas 분석) 1. Sample Data 2. 데이터 작업 절차 3. 사용 모듈 from print_df import print_df from pandas import ExcelFile from pandas import DataFrame from matplotlib import pyplot as plt import numpy as np 4. 데이터 수집 # 엑셀파일 읽기 xls_file = ExcelFile('C:\\python_StudyGroup\\200215\\data\\mpg.xlsx') # 엑셀의 sheet 이름들 중에서 0번째 sheet를 dataframe으로 변환 df = xls_file.parse(xls_file.sheet_names[0], index_col=0) print_df(df.head()) > 결..
[API]영화진흥원 박스오피스 순위 분위 1. API 발급 Site - http://www.kobis.or.kr/kobisopenapi/homepg/main/main.do 영화진흥위원회 오픈API www.kobis.or.kr 2. 데이터 작업 절차 - 수집(Data Collection) > 전처리(Data pretreatment) > 정제(Data refining) > 시각화(Data Visualization) 3. 사용 패키지 import datetime as dt import requests import json import pandas as pd from pandas import DataFrame from matplotlib import pyplot as plt from print_df import print_df 4. 데이터 수집 # 영..
[Python]Data Preparation Basic(데이터 전처리 기초) 5 Live Codeing 1. Sample Data # 딕셔너리 성적 리스트 grade_dic = { '국어': [98, 88, 68, 64, 120], '영어': [None, 90, 60, 20, 50], '수학': [90, 70, None, 31, None], '과학': [120, 50, None, 60, 88] } 2. 상자 수염 그림으로 이상치 확인하기 from pandas import DataFrame from Data import grade_dic from print_df import print_df from matplotlib import pyplot from sklearn.impute import SimpleImputer import numpy df = DataFrame(grade_dic, ..
[Python]Data Preparation Basic(데이터 전처리 기초) 4 Live Codeing 1. Sample Data # 딕셔너리 성적 리스트 grade_dic = { '국어': [98, 88, 68, 64, 120], '영어': [None, 90, 60, 20, 50], '수학': [90, 70, None, 31, None], '과학': [120, 50, None, 60, 88] } 2. 결측치 여부 확인 from pandas import DataFrame from Data import grade_dic from print_df import print_df df = DataFrame(grade_dic, index=['노진구', '이슬이', '비실이', '퉁퉁이', '도라에몽']) # print_df(df) # 결측치 확인 null_data = df.isnull() nu..
[Python]Data Preparation Basic(데이터 전처리 기초) 3 Live Codeing 1. Sample Data # 딕셔너리 성적 리스트 grade_dic = { '국어': [98, 88, 68, 64, 120], '영어': [None, 90, 60, 20, 50], '수학': [90, 70, None, 31, None], '과학': [120, 50, None, 60, 88] } 2. 신규 열 추가 from pandas import DataFrame from Data import grade_dic from print_df import print_df df = DataFrame(grade_dic, index=['노진구', '이슬이', '비실이', '퉁퉁이', '도라에몽']) # print_df(df) # 새로운 열 추가 df['프로그래밍'] = [92, 49, 21,..