[問題] 2Dimensional Numpy array 找unique rows

看板Python作者 (Brian)時間9年前 (2016/07/10 02:37), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
這是udacity deep learning course 其中一個problem 找unique rows 這是網上找到的一個方法 def unique_rows(a): a = np.ascontiguousarray(a) unique_a = np.unique(a.view([('', a.dtype)]*a.shape[1])) return unique_a.view(a.dtype).reshape((unique_a.shape[0], a.shape[1])) 三個關鍵的Numpy function: ascontiguousarray view unique 其中我完全了解unique 但我不了解ascontiguousarray 和 view 跪求大家指教 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 50.185.236.143 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1468089424.A.D48.html
文章代碼(AID): #1NWKHGr8 (Python)
文章代碼(AID): #1NWKHGr8 (Python)