NumPy and SciPy – Difference between .todense() and .toarray() August 2, 2023 by Tarik toarray returns an ndarray; todense returns a matrix. If you want a matrix, use todense; otherwise, use toarray.