본문 바로가기

파이썬10

[Python] ChatGPT 앱 Appstore, Google Playstore 리뷰 크롤링(App ID 확인하기) 01. Appstore 리뷰 가져오기1. app_store_scraper 설치하기!pip install app_store_scraper   2. 리뷰 크롤링from app_store_scraper import AppStore# 1. AppStore Reviewdef extract_appstore_reviews(app_name: str, app_id: int): app = AppStore(country='us', app_name=app_name, app_id=app_id) # country='kr': 한국 app.review() app_reviews = pd.DataFrame(app.reviews) if 'date' not in app_reviews.columns: app.. 2024. 12. 19.
[Python] Google Colab 단축키 👀 내가 보려고 쓰는 글  Ctrl + M, B : 코드 셀 삽입Ctrl + M, D : 코드 셀 삭제 Ctrl + M, K : 코드 셀 위로 이동Ctrl + M, J : 코드 셀 아래로 이동Ctrl + M, Z : 코드 셀 삭제 실행 취소     Ctrl + F9 : 모두 실행Ctrl + F8 : 이전 셀 모두 실행Ctrl + F10 : 이후 셀 모두 실행 (모두 실행하다가 오류 나면 그 이후 셀부터는 모두 실행이 안 돼서... 유용하게 썼다)Ctrl + Enter : 해당 셀 실행 2024. 6. 4.
[Python] Google Colab에서 'TfidfVectorizer' object has no attribute 'get_feature_names' Error 해결하기 오류 토픽 모델링 예제 실습 중 'TfidfVectorizer' object has no attribute 'get_feature_names'라는 오류가 발생했다.       해결방법   get_feature_names를 get_feature_names_out()로 변경한다. # sklearn 버전 이슈로 메서드 변경terms = vectorizer.get_feature_names_out()# 각 20개 행의 1,000개 열 중 가장 값이 큰 5개를 찾아서 단어로 출력def get_topics(components, feature_names, n=5): for idx, topic in enumerate(components): print("Topic %d:" % (idx+1), [(feat.. 2024. 5. 31.
[Python] 문자열 slice 👀 내가 보려고 쓰는 글  문자열 slice 문자열 앞의 n글자 : str[:n] 문자열 뒤의 n글자 : str[ -n :] 문자열 역순 : str[::-1] 2024. 3. 20.
[Python] enumerate 함수(with 프로그래머스>부분 문자열 이어 붙여 문자열 만들기) 📝 문제.https://school.programmers.co.kr/learn/courses/30/lessons/181911  enumerate(iterable, start=0) iterable : 순서가 있는 이터레이터 입력start : 시작 시퀀스, 기본값 0, 특정 value로 설정 가능for문에서 index, value 동시에 확인할 때 사용할 수 있음 seasons = ['Spring', 'Summer', 'Fall', 'Winter']list(enumerate(seasons))#[(0, 'Spring'), (1, 'Summer'), (2, 'Fall'), (3, 'Winter')]list(enumerate(seasons, start=1)) # 시퀀스 시작 숫자를 1로 지정#[(1, 'Spri.. 2024. 3. 20.
[Python] endswith 함수(with 프로그래머스>접미사인지 확인하기) 📝 문제.https://school.programmers.co.kr/learn/courses/30/lessons/181908   str.endswith(접미사[,start [,end]])문자열이 지정된 접미사로 끝나면 True, 그렇지 않으면 False 반환접미사: string이랑 tuple만 사용할 수 있음start : 선택 입력 사항, 입력 시 해당 value부터 문자열 비교end : 선택 입력 사항, 입력 시 해당 value까지 문자열 비교 String에서 endswith( ) 함수 사용ex_str = "It’s been a long time!"ex_str.endswith('time!') # Trueex_str.endswith('time') # Falseex_str.endswith('!') # T.. 2024. 3. 20.
[Python] Google Colab에서 name 'tqdm' is not defined Error 해결하기 오류 한국어 Word2Vec 만들기 예제 실습 중 name 'tqdm' is not defined라는 오류가 발생했다.      해결방법 tqdm 패키지를 설치해 준다. # tqdm 패키지 설치!pip3 install tqdmfrom tqdm import tqdm         📌 참고. https://stackoverflow.com/questions/47529792/no-module-named-tqdm No module named 'tqdm'I am running the following pixel recurrent neural network (RNN) code using Python 3.6 import os import logging import numpy as np from tqdm import .. 2024. 3. 4.
[Python] Google Colab에서 numpy has no attribute 'int' Error 해결하기 오류 계단 함수 예제 실습 중 numpy numpy has no attribute 'int'라는 오류가 발생했다.      해결방법  numpy version을 1.23.0 이하로 설치해 준다. # numpy version 1.23.0 이하로 install!pip install numpy==1.23.0# numpy version 확인import numpy as npprint(np.__version__)         📌 참고. https://velog.io/@juyeon048/ERROR-AttributeError-module-numpy-has-no-attribute-int  [ERROR] AttributeError: module 'numpy' has no attribute 'int'DeepSORT 알고.. 2024. 2. 29.
[Python] Google Colab에서 NLTK downloader Error 해결하기 오류  NLTK로 불용어 제거하는 예제 실습 중 Resource stopword not found.라는 오류가 발생했다.     해결방법  NLTK 불용어 패키지를 다운로드한다.# nltk 불용어 다운로드import nltknltk.download('stopwords')nltk.download('punkt')          📌 참고. https://taepseon.tistory.com/76 nltk 오류 발생 corpus 자료 downloadNLTK 패키지의 corpus 자료는 설치시 제공되지 않는다 따라서 download의 명령으로 사용자가 다운로드 받아야 한다. 이걸 몰라서.... from nltk.corpus import stopwords stop = stopwords.words('english.. 2024. 2. 25.
[Python] 윈도우에서 파이썬 설치하기 👀 내가 보려고 쓰는 글  01. 파이썬 설치하기 1. 파이썬 홈페이지(https://www.python.org/downloads/)에서 최신 설치파일 다운로드하기  2. 설치파일 실행 후 [Add python.exe to PATH] 체크 → [Install Now] 눌러서 설치하기     02. 파이썬 에디터 설치하기  1. 비주얼 스튜디오 코드 홈페이지에서(https://code.visualstudio.com/Download) 설치파일 다운로드하기  2. [동의합니다] 체크 → [다음]  3. 기본 설정(Code를 지원하는 파일 형식~/PATH에 추가~) 확인 후 [다음]  4. 설치 완료 2024. 2. 13.
728x90