I did tfidf with manual syntax and I got the results of the tf idf vector in the form of a data series. the data is as follows:
print(type(dataset["TFIDFVec"]))
print(dataset["TFIDFVec"])
<class pandas.core.series.Series>
0 [0.0, 0.6307448112902039, 0.0, 0.0, 0.0, 0.0, ...
1 [0.0, 0.0, 1.3985703304477997, 0.0, 0.0, 0.0, ...
I want to convert it to an array. I use to_numpy() code but it output list in array. what I tried is the following:
tfidffixarr = dataset["TFIDFVec"].to_numpy()
tfidffixarr
array([list([0.0, 0.6307448112902039, 0.0, 0.0,...,0.0]),
list([0.0, 0.0, 0.0, 0.0,...,0.0])],
I want it to be jut like this:
[[0 0.6307448112902039 0,..., 0 0 0]
[0 0 0 ,..., 0 0 0]
[0 0 0 ,..., 0 0 0]]
Does anyone know how to fix it?
np.array(tfidffixarr.tolist())