How do we return a sparse matrix and an array data from a function. My sparse matrix is
sparse_mat
<540x5550 sparse matrix of type '' with 9068 stored elements in COOrdinate format>
and the other data is session_id:
array([['192.168.113.111_timesofindia.indiatimes.com_1', 'User'],
['192.168.113.111_timesofindia.indiatimes.com_2', 'User'],
dtype='|S46')
I want to return both these data from a function.Thanks
You can return more than one value from a Python function by returning a tuple:
return sparse_mat, session_id
The caller can get the returned value by something like:
m, id = your_function()
Oh, and it doesn't make any difference if there are two different data types. You can return two values of the same type too of course.