Analyze Data/Python Libraries 20

numpy-empty, where, allclose, dot, argsort, corrcoef, astype, nan, hstack, argmax

empty Return a new array of given shape and type. np.empty((3,3)) >>> array([[-1., 0., 5.], [12., 18., 24.], [35., 60., inf]]) where Return elements depending on condition. ar=np.arange(1,10) np.where(ar>5) >>> (array([5, 6, 7, 8]),) allclose Returns True if two arrays are element-wise equal. np.allclose([2,3],[2,3],equal_nan=True) >>> True equal_nan : Whether to compare NaN’s as equal. If True,..

regular expression

re Regular Expression. prodlist >>> 0 (직) 데친고사리 1kg(냉장} 1 (직) 깐도라지채 1kg(냉장} 2 콩나물 박스 4kg(상 곱슬이) 3 *삼색수제비 1kg(동성 냉동) 4 *)자숙바지락살 350g(냉동) ptn = "\([^)]+\)}" prodlist = [re.sub(ptn, "", str).strip() for str in prodlist] prodlist >>> ['데친고사리 1kg(냉장}', '깐도라지채 1kg(냉장}', '콩나물 박스 4kg', '*삼색수제비 1kg', '*)자숙바지락살 350g'] prodlist = [ re.sub("([0-9]+)?(k)?g", "", str).strip() for str in prodlist ] prodlist >>..