[Python] Matplotlib
In [1]: import matplotlib.pyplot as plt In [2]: y = [2, 4, 6] # plot - 선 그래프(Line plot) plt.plot(y) plt.show() In [3]: y = [2, 4, 6] x = [1, 2, 3] # plot - 선 그래프(Line plot) plt.plot(x, y) # x 와 y의 갯수가 맞지 않으면 error plt.show() In [4]: # line style -> ls plt.plot(x,y, ls = '--') plt.show() In [5]: # Marker plt.plot(x, y, marker='o') plt.show() In [6]: x = [2, 4, 6, 8] y = [10, 13, 16, 20] y2 = [10,..
2023. 10. 16.
[Python] 딕셔너리
딕셔너리 In [1]: # 딕셔너리 생성 # 딕셔너리명 = {Key:value,Key:value , , } # key값은 변하지 않을 값, 동일한 key는 여러개가 올 수 없다 a = {} b = {'name':'youngD', 'pn':'010-1234-5678'} c = {1 : 'youngD', 2:'oldD'} print(type(a)) print(a) {} In [2]: # 딕셔너리 값 추가 dic1 = {'name':'youngD', 'age':20, 'phone': '010-1234-5678'} dic1['birth'] = '07/05' # 딕셔너리 값 변경 dic1['name'] = 'oldD' print(dic1) {'name': 'oldD', 'age': 20, 'phone': '010..
2023. 10. 11.