본문 바로가기
반응형

Python8

파이썬 매뉴얼 # 파이썬 공식 문서https://docs.python.org/3/contents.html Python Documentation contentsWhat’s New in Python- What’s New In Python 3.12- Summary – Release highlights, New Features- PEP 695: Type Parameter Syntax, PEP 701: Syntactic formalization of f-strings, PEP 684: A Per-Interprete...docs.python.orghttps://docs.python.org/ko/3/contents.html Python Documentation contentsWhat’s New in Python- What’s Ne.. 2024. 7. 31.
데이터 튜플 자료형 튜플(tuple)은 몇 가지의 차이점을 제외하고는 리스트와 거의 비슷하다. 리스트는 []으로 감싸서 사용하지만, 튜플은 ()으로 사용 리스트는 그 값의 추가, 삭제, 수정이 가능하지만 튜플은 값을 변경할 수 없다. t1 = () t2 = (1,) # 한 개의 값만 가질 경우 , 필수 t3 = (1,2) t4 = 1,2,3 # ()를 생략 할 수 있다. t5 = (1,2,3,('a','b')) # 튜플안에 또 다른 튜플이 가능 튜플은 요소값을 수정, 삭제하려면 오류 발생 >>> t1 = (1, 2, 'a', 'b') >>> del t1[0] Traceback (most recent call last): File "", line 1, in TypeError: 'tuple' object doesn't supp.. 2020. 12. 7.
[Python] matplotlib 그래프 한글 깨짐 matplotlib 그래프 한글 깨짐 matplotlib을 이용하여 그린 그래프에서 한글이 깨져서 표시가 된다. 해당 현상을 피하려면 Font를 변경해줘야 한다. 현상 import matplotlib import sys import pandas as pd df = pd.read_csv('data/score.csv') df.index = df['이름'] df['국어'].plot(kind='bar') 수정 import matplotlib import platform print(platform.system()) # 플랫폼 확인 # Window if platform.system() == 'Windows': matplotlib.rc('font', family='Malgun Gothic') elif platform.. 2020. 11. 28.
[IPython] %matplotlib inline 의미 %matplotlib inline 의미 https://ipython.readthedocs.io/en/stable/interactive/plotting.html Rich Outputs출력 옵션으로, 이미지, 사운드, 애니메이션 등으로 표현할 수 있는 객체는 프론트(Jupyter Notebook)에서 표시되도록 하는 기능이며, IPython 5.4+ 및 6.1+ 에서 사용 가능 %matplotlib inline 명령어를 사용하면 플로팅 명령의 출력이 Jupyter Notebook과 같은 프론트에서 실행하면 결과를 셀 아래 inline으로 표시 %matplotlib inline import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 3*np.. 2020. 11. 27.
반응형