본문 바로가기

Python Basic22

15. 산점도 import matplotlib.pyplot as pltimport matplotlibmatplotlib.rcParams['font.family'] = 'Malgun Gothic'matplotlib.rcParams['font.size'] = 15matplotlib.rcParams['axes.unicode_minus'] = Falseimport pandas as pddf = pd.read_excel('../pandas/score.xlsx')dfdf['학년'] = [3, 3, 2, 1, 1, 3, 2, 2]dfplt.scatter(df['영어'], df['수학'])plt.xlabel('영어 점수')plt.ylabel('수학 점수') import numpy as npsizes = np.random.rand(8.. 2024. 7. 3.
14. 원 그래프 (심화) import matplotlib.pyplot as pltimport matplotlibmatplotlib.rcParams['font.family'] = 'Malgun Gothic'matplotlib.rcParams['font.size'] = 15matplotlib.rcParams['axes.unicode_minus'] = Falsevalues = [30, 25, 20, 13, 10, 2] #원그래프 그릴 때 values 와 labels 필요함.labels = ['Python', 'Java', 'Javascript', 'C#', 'C/C++', 'ETC']plt.pie(values, labels=labels, autopct='%.1f%%', startangle = 90, counterclock = Fals.. 2024. 7. 2.
13. 원 그래프 (기본) import matplotlib.pyplot as pltimport matplotlibmatplotlib.rcParams['font.family'] = 'Malgun Gothic'matplotlib.rcParams['font.size'] = 15matplotlib.rcParams['axes.unicode_minus'] = Falsevalues = [30, 25, 20, 13, 10, 2] #원그래프 그릴 때 values 와 labels 필요함.labels = ['Python', 'Java', 'Javascript', 'C#', 'C/C++', 'ETC']plt.pie(values)plt.show()values = [30, 25, 20, 13, 10, 2] #원그래프 그릴 때 values 와 labels .. 2024. 7. 2.
12. 다중 막대 그래프 import pandas as pdimport matplotlib.pyplot as pltimport matplotlibmatplotlib.rcParams['font.family'] = 'Malgun Gothic'matplotlib.rcParams['font.size'] = 15matplotlib.rcParams['axes.unicode_minus'] = Falsedf = pd.read_excel('../Pandas/score.xlsx')dfimport numpy as npnp.arange(5)array([0, 1, 2, 3, 4]) np.arange(3,6) #리스트와 비슷하게 연속된 데이터들의 집합array([3, 4, 5]) # 3에서부터 6 이전까지의 데이터를 리스트 형태로 불러옴.arr =.. 2024. 7. 1.