我有一个从TfidfTransformer.transform
计算出来的csr_matrix
对象。 我想要序列化和反序列化:
tf_csrmtrix = TfidfTransformer.transform(data)
json.dumps(tf_csrmtrix)
TypeError: Object of type 'csr_matrix' is not JSON serializable
我该如何处理这种数据:csr矩阵?
我有一个从TfidfTransformer.transform
计算出来的csr_matrix
对象。 我想要序列化和反序列化:
tf_csrmtrix = TfidfTransformer.transform(data)
json.dumps(tf_csrmtrix)
TypeError: Object of type 'csr_matrix' is not JSON serializable