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

Peng Yu <[email protected]> Tue, 28 Jan 2020 21:44:34 -0600
Newsgroups gmane.comp.python.scientific.user
Message-ID <CABrM6wmZafmkCu3PMtzeovAWLARD_PznyNkH5q-D5LHxy1Q2vg@mail.gmail.com>
No. Which one to try?

Just to be clear I want to eventually use the sparse matrix with
sklearn's .fit().

On 1/28/20, Hjalmar Turesson <[email protected]> wrote:
> Have you tried using Pandas?
>
> https://pandas.pydata.org/pandas-docs/stable/user_guide/sparse.html
>
> On Tue, Jan 28, 2020 at 10:09 PM Peng Yu <[email protected]> wrote:
>
>> Suppose that I have a TSV file in the following format.
>>
>> ```
>> row_name<TAB>col_name<TAB>value
>> ```
>>
>> Is there an easy way to read it into a sparse matrix format in scipy?
>> Thanks.
>>
>> I don't see such examples in the doc.
>>
>> https://docs.scipy.org/doc/scipy/reference/sparse.html
>>
>> --
>> Regards,
>> Peng
>> _______________________________________________
>> SciPy-User mailing list
>> [email protected]
>> https://mail.python.org/mailman/listinfo/scipy-user
>>
>


-- 
Regards,
Peng