[SciPy-User] How to read row_name, col_name, value format TSV into a sparse matrix?

Peng Yu pengyu.ut at gmail.com
Tue Jan 28 22:44:34 EST 2020


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 <hturesson at gmail.com> 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 <pengyu.ut at gmail.com> 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
>> SciPy-User at python.org
>> https://mail.python.org/mailman/listinfo/scipy-user
>>
>


-- 
Regards,
Peng


More information about the SciPy-User mailing list