일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- 액션
- 웹툰
- pandas
- 커피
- 이범선
- 산책
- QGIS
- 아주 작은 습관의 힘
- python
- 네이버 완결 웹툰
- geopandas
- 네이버 웹툰
- 완결 웹툰
- 애니메이션
- 빅데이터 분석기사
- 제임스 클리어
- 영화
- 완결
- 진심
- 넷플릭스
- 서귀포
- 가족
- 로맨스
- 네이버
- 제주도
- 사랑
- 만화 영화
- 이기적 출판사
- 빅데이터 분석기사 필기
- 습관
- Today
- Total
목록python (9)
JuJuKwakKwak

위의 사진처럼 pdf 파일이 150개나 있다. 150개의 pdf 파일을 1개의 pdf 파일로 합치고 싶다. 코드는 아래와 같다. !pip install PyPDF2 PATH = r'pdf 파일이 있는 파일 경로' os.chdir(PATH) os.getcwd() from PyPDF2 import PdfFileMerger pdfs = [] for i in range(1, 151): pdfs.append(f'{i}.pdf') print(len(pdfs)) # pdf 파일 순서를 1->2->3으로 하기 위해서 위의 방식을 사용했다. merger = PdfFileMerger() for pdf in pdfs: merger.append(pdf) merger.write("1-150.pdf") merger.close()

jpg 사진 파일을 pdf 파일로 바꾸고 싶다 위의 사진처럼 하나씩 나열된 사진 파일들을 위의 사진처럼 하나씩 pdf 파일로 변환하고 싶다 코드는 아래와 같다 !pip install Pillow import os import pandas as pd from PIL import Image PATH = r'사진 파일이 있는 파일 경로' os.chdir(PATH) # PATH를 현재 경로로 설정하기 os.getcwd() # 현재 경로 확인하기 jpgs = [] for i in range(1, 114): # 1부터 113 숫자 생성하기 jpgs.append(f'{i}.jpg') # '1.jpg' 이런 식으로 만들기 print(len(jpgs)) # 113개 인지 확인하기 # 위의 방식을 하는 이유는 파이썬이 자..
데이터 불러오기 import os import pandas as pd csv02_list = [] # 2번에 있는 파일들을 불러와 담는 리스트 f_name_list = [] # 2번에 있는 파일들의 이름들을 담는 리스트 for f_name in os.listdir('./2번'): if f_name.endswith('.csv'): f_name_list.append(f_name) csv_file02 = pd.read_csv(f'./2번/{f_name}', encoding='euc-kr') csv02_list.append(csv_file02) csv10_list = [] # 10번에 있는 파일들을 불러와 담는 리스트 for f_name in os.listdir('./10번'): if f_name.endswit..
데이터 불러오기 import os import pandas as pd csv02_list = [] # 파일 담는 리스트 for f_name in os.listdir('./가져올 폴더 이름_1'): if f_name.endswith('.csv'): csv_file02 = pd.read_csv(f'./가져올 폴더 이름_1/{f_name}', encoding='euc-kr') csv02_list.append(csv_file02) csv10_list = [] # DataFrame 담는 리스트 f_name_list = [] # 파일 이름 담는 리스트 for f_name in os.listdir('./가져올 폴더 이름_2'): if f_name.endswith('.csv'): f_name_list.append(f_..
참고 : https://bskyvision.com/entry/python-matplotlibpyplot%EB%A1%9C-%EA%B7%B8%EB%9E%98%ED%94%84-%EA%B7%B8%EB%A6%B4-%EB%95%8C-%ED%95%9C%EA%B8%80-%EA%B9%A8%EC%A7%90-%EB%AC%B8%EC%A0%9C-%ED%95%B4%EA%B2%B0-%EB%B0%A9%EB%B2%95 [python] matplotlib로 플롯 그릴 때 한글 깨짐 문제 해결 방법 (윈도우) matplotlib는 대표적인 데이터 시각화를 위한 파이썬 라이브러리입니다. 특히 pandas나 numpy 패키지를 자주 사용하시는 분들은 아주 유용하게 사용할 수 있는 시각화 라이브러리입니다. 오늘은 한국 bskyvision.co..
car_num = car.select_dtypes(['number'])
from sklearn.model_selection import train_test_split x = liver[liver.columns.difference(['Dataset'])] y = liver['Dataset'] train_x, test_x, train_y, test_y = train_test_split(x, y, stratify=y, train_size=0.7, random_state=1) print(train_x.shape, test_x.shape, train_y.shape, test_y.shape)
1) 날짜 유형 바꾸기 df_sample['yearqtr'] = pd.to_datetime(df_sample['yearqtr']) 2) 분기별로 나누어 바꾸기 df_sample['yearqtr'] = pd.PeriodIndex(df_sample['yearqtr'], freq='Q') 3) 조건식을 사용해서 추출하기 df_sub = df.loc[df['행정동']=='심곡동', :] 4) str.replace(), str.split() 사용하기 df_sample['yearqtr'] = df_sample['yearqtr'].str.replace(pat=r'[ㄱ-ㅣ가-힣]', repl=r'', regex=True) # 한글 제거 # 2017년 1분기 => 2017 1 df['수정할 열'] = df['수정할 열'..