python – what is the best way to store sparse vector in pandas dataframe cell? – Code Utility


I have a sparse vector with length of 1e5. But each vector only has about 10-100 noezero data. Thus I used coo or k:v pair to represent this vector. However store varied length array/list in dataframe cell seems a bad idea. And I do need to apply some arithmetic operators on the vectors: add between vectors, sum of several vectors, multiply vector by single float value. I wonder what is the best way to store this vector in dataframe without convert it to dense array.