[Python] 샘플 갯수에 따른 Uniform distirbution
Uniform distribution을 갖는 랜덤변수의 샘플수에 따른 distribution을 그려본다. 샘플수는 (10, 100 , 1000, 10000)이며 비교를 위해서 subplot으로 그린다. from scipy.stats import uniform import matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots(1,4, figsize=(18,5)) np.random.seed(12) # 0~100의 uniform distribution을 갖는 카드를 뽑을 때의 probability distribution cards_10 = uniform.rvs(0,100, size=10) cards_100 = uniform.rvs(0,100, ..
2022. 12. 16.
[Python] 키워드인수와 딕셔너리 언패킹 (**)
딕셔너리 언패킹 ## 키워드 인수와 딕셔너리 언패킹 def product_info(name:str, height:int, width:int, weight:int, price:int): print(f"Product[{name}] is ({height}x{width}), {weight}kg and the pricce of {price}") product_info(**{'name':"TV", 'height':300, 'width':300, 'weight':5, 'price':1000000}) ----------------------- Product[TV] is (300x300), 5kg and the pricce of 1000000 파이썬으로 딕셔너리 정보를 키워드 인수로 전달할 때는 **을 사용하여 키워드이..
2022. 12. 10.