Numpy : from itertools import product
from itertools import product from itertools import product X = np.array([[1.50,2],[1.60,2],[1.70,2], [1.80,2], [2.00,2], [2.20, 2], [2.50,2], [2.80,2],[3.00,2], [3.30,2], [3.60,2], [5.00,2], [1.50,1],[1.60,1],[1.70,1], [1.80,1], [2.00,1], [2.20, 1], [2.50,1], [2.80,1],[3.00,1], [3.30,1], [3.60,1], [5.00,1], [1.50,3],[1.60,3],[1.70,3], [1.80,3], [2.00,3], [2.20, 3], [2.50,3], [2.80,3],[3.00,3], ..
2020. 6. 4.
Numpy : np.linspace (구간에 점 만들기)
numpy.linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0) Return evenly spaced numbers over a specified interval. Returns num evenly spaced samples, calculated over the interval [start, stop]. The endpoint of the interval can optionally be excluded. Changed in version 1.16.0: Non-scalar start and stop are now supported. 처음 start, stop을 지정해주고 num을 적어주면, 그 숫자만큼 구간에서 점을 ..
2020. 6. 4.
Python : 반올림, 올림, 내림
반올림 : round(실수, n) >>> n = 7/15 >>> n 0.4666666666666667 >>> round(n,2) 0.47 >>> round(n,4) 0.4667 >>> round(n) 0 >>> type(round(n)) 정수도 -를 사용해서 반올림 가능하다. >>> round(12345,-1) 12340 >>> round(12345,-2) 12300 올림, 내림 : math.ceil, math.floor import math >>> math.ceil(12.2) 13 >>> math.floor(12.2) 12 출처 : https://dpdpwl.tistory.com/94 [Python]파이썬 자리수 조절(소수점,올림,반올림) 실수를 표현할때, 자리수를 원하는대로 조절하고, 정수의 올림 반..
2020. 6. 4.