Re: How to read row_name, col_name, value format TSV into a sparse matrix?

Peng Yu <[email protected]> Wed, 29 Jan 2020 03:33:45 -0600
Newsgroups gmane.comp.python.scientific.user
Message-ID <CABrM6wmXCgbFuHP4RiZEzC8Bz0NGStPQXf9QjhDT4_4Wrdw6Ow@mail.gmail.com>
> Reading the csv/tsv (either with pandas or numpy) doesn't create a matrix
> at all. It just gives you the data as it is in the file: values with
> associated coordinates. Then you would use something like
> scipy.sparse.coo_matrix() to convert that to a sparse matrix.

Where it documented that pandas.read_csv don't generate the whole
matrix? The return value is either of the two?

"""
DataFrame or TextParser

    A comma-separated values (csv) file is returned as two-dimensional
data structure with labeled axes.
"""

Are you referring "TextParser"? How to control which one to return? I
don't see an option for it.

Which function of numpy do refer to specifically? numpy.loadtxt? It
returns ndarray, which should read a dense matrix into the memory.

-- 
Regards,
Peng