728x90 Python20 TypeError: sub_process() takes 1 positional argument but 11 were given 멀티 프로세싱 관련, 초기 작업 중 발생한 error 코드는 아래와 같다. # 메인 프로세스 if __name__ == "__main__": print("[main] start") p = mp.Process(target=sub_process, args=("startcoding")) p.start() print("[main] end") error 수정 코드는 아래와 같다. # 메인 프로세스 if __name__ == "__main__": print("[main] start") p = mp.Process(target=sub_process, args=("startcoding",)) p.start() print("[main] end") 차이점은 mp.Process 내 args (튜플 형태) 설정 시 1개만 부여.. Python 2024. 1. 25. re.error: look-behind requires fixed-width pattern 아래는 정규표현식에서 '후방 탐색(look-behind)' 시도하다 발생한 error 코드이다. # 2. Substitution (교체) str3 = "010-2343-4444" result = re.sub("(? Python 2024. 1. 24. 파이썬 코딩 High Level vs. Low Level 파이썬으로 '로또 번호 추출기'라는 프로그램을 직접 코딩한 후 강의 강사가 직접 작성한 코드와 비교한 결과 느낀 점을 제목에 반영했다. 이 프로그램의 특징은 모두가 알다시피 다음과 같다. 1~45 숫자들 중에서 서로 다른 6개의 숫자 추출 코드 영역은 ①공통 영역과 ②Main 영역, 그리고 ③결과 확인 영역 순서의 총 3 영역으로 분류하는데 이 영역들 중 Main 영역에서 차이점이 드러난다. 일단, 차이가 없는 공통 영역과 결과 확인 영역은 다음과 같다. ※ 공통 영역 # 로또 번호 추출기 import random def get_random_number(): number = random.randint(1, 45) return number lotto_numbers = [] # 로또 번호를 저장할 리스트 ※.. Python 2023. 1. 18. 파이썬 코딩 스타일 아래 링크들을 참조해서 코딩하면 된다. PEP (Python Enhancement Proposals) 8 – Style Guide for Python Code PEP 8 – Style Guide for Python Code | peps.python.org PEP 8 – Style Guide for Python Code Author: Guido van Rossum , Barry Warsaw , Nick Coghlan Status: Active Type: Process Created: 05-Jul-2001 Post-History: 05-Jul-2001, 01-Aug-2013 Table of Contents This document gives coding conventions for the Python co .. Python 2023. 1. 17. Windows 11 상에서 PyQt5 & Qt Designer 사용하기 위한 절차 PyQt5 & Qt Designer 설치를 하기 전 환경은 다음과 같다. OS: Windows 11 Pro Python 버전: 3.11.0 pip 버전: 22.3.1 연관 사이트는 아래와 같다. PyQt5 PyQt5 Python bindings for the Qt cross platform application toolkit pypi.org PyQt5Designer PyQt5Designer PyQt5 Designer pypi.org 아래처럼 차례로 명령어를 입력하여 설치가 제대로 되었는지를 확인한다. C:\Users\[사용자명]>pip install PyQt5 Collecting PyQt5 Using cached PyQt5-5.15.7-cp37-abi3-win_amd64.whl (6.8 MB) Colle.. Novice Developer 2022. 12. 15. SpartaCodingClub - 직장인을 위한 실전 데이터 분석4기 ◎ 0주차 강의명: 직장인을 위한 실전 데이터 분석4기 기간: 2022년 12월 5일 (월) ~ 2023년 1월 9일 (월), 총 5주 완주할 수 있기를... ◎ 1주차 kaggle Kaggle: Your Machine Learning and Data Science Community Kaggle is the world’s largest data science community with powerful tools and resources to help you achieve your data science goals. www.kaggle.com Google Spread Sheet Google Sheets: 로그인 이메일 또는 휴대전화 accounts.google.com XLMiner Analysis Tool.. Novice Developer 2022. 12. 12. [Jupyter Notebook] TypeError: 'method' object is not subscriptable 마주하게 된 오류 메시지이다. --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In [53], line 1 ----> 1 sum_of_students_by_class = sum_of_students_by_class.drop['user_id'] 2 sum_of_students_by_class TypeError: 'method' object is not subscriptable 그리고 상기 오류를 유발한 코드 위치가 오류 메시지에 보면 1행이라고 나와 있다. 이에 대한 오류를 잡은 정상 코드는 다음과 같다. sum_of_students.. Python 2022. 12. 9. [Jupyter Notebook] UserWarning: Glyph 49688 (\N{HANGUL SYLLABLE SU}) missing from current font. matplotlib 사용 중 나타나는 경고 메시지를 제목으로 잡았는데, 제목 내 HANGUL이란 단어에서 유추 가능하듯이 한글이 깨지는 경우(==네모 '□'로 나타나는 경우) 발생하는 경고이다. 해당 경고를 없애기 위해 가열찬 구글링으로 찾아서 참고한 글은 아래의 글이다. Ubuntu에서 Matplotlib 한글 폰트 설정 Ubuntu에서 Matplotlib 한글 폰트 설정 | Hooni's Playground 안적어두니 매번 까먹는다. 방법만 알면 간단하지만, 방법을 조금이라도 까먹으면 바로 삽질을 하게된다. Ubuntu 환경에서 나눔 폰트를 사용한다는 가정하에 다음의 방법을 따르면 된다. 나눔 폰 hooni-playground.com 경고를 없애기 전, 일단 맞닥트린 전체 경고 메시지 중 하나는 다음.. Python 2022. 12. 7. [Jupyter Notebook] TypeError: barplot() got multiple values for argument 'data' 아래는 제목의 오류를 가져오게 한 코드와 오류 내용이다. #그래프 크기 설정 plt.figure(figsize = (14, 5)) # 바 그래프 그리기 (x축 = Age_cat, y축 = Survived) sns.barplot('Age_cat', 'Survived', data = titanic) # 그래프 나타내기 plt.show() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In [37], line 5 2 plt.figure(figsize = (14, 5)) 4 # 바 그래프 그리기 (x축 = Age_cat, y축 = Sur.. Python 2022. 12. 6. SpartaCodingClub - 금융인을 위한 파이썬 업무자동화 25기 ◎ 0주차 강의명: 금융인을 위한 파이썬 업무자동화 25기 기간: 2022년 11월 21일 (월) ~ 2022년 12월 26일 (월), 총 5주 완주할 수 있기를... ◎ 1주차 Google Colaboratory (Colab) ⇒ 구글 계정으로 로그인 필요!!! Welcome To Colaboratory Run, share, and edit Python notebooks colab.research.google.com !pip install bs4 requests 입력하여 설치 !pip install openpyxl 입력하여 설치 1주차에서 순차적으로 사용한 import 구문들 import requests from bs4 import BeautifulSoup from openpyxl import Work.. Novice Developer 2022. 12. 1. [Jupyter Notebook] ValueError: Cannot set a DataFrame with multiple columns to the single column ma2 먼저 제목의 오류 발생하기 전 코드와 결과이다. from pandas_datareader import data as pdr import yfinance as yf yf.pdr_override() import numpy as np import pandas as pd import FinanceDataReader as fdr df = fdr.DataReader('005930', '2018') df = df[['Close']].copy() df['ma1'] = df.rolling(3).mean().shift(1) df 제목의 오류가 발생한 코드이다. 1 from pandas_datareader import data as pdr 2 3 import yfinance as yf 4 yf.pdr_override() 5.. Python 2022. 11. 28. [Jupyter Notebook] ImportError: matplotlib is required for plotting when the default backend "matplotlib" is selected. 오류 원문이다. ImportError: matplotlib is required for plotting when the default backend "matplotlib" is selected. 저 오류는 필요한 패키지를 설치하지 않아 발생하는 오류이다. 따라서 해당 패키지를 설치하면 오류는 사라진다. !pip install matplotlib 입력하여 설치 Python 2022. 11. 26. 이전 1 2 다음 💲 추천 글 반응형 SMALL