Feb-22-2019, 10:28 PM
Hi, All!
I need to unpack a pkl file, but since I'm not familiar with pickle, pandas, and numpy, I'm having a very hard time trying to do that.
The content of the pkl file is something like:
I need to get the words and the real-valued vectors for each word and create a csv file...
The content of the csv file must look like:
Thanks a lot!
Cheers,
Jonn
I need to unpack a pkl file, but since I'm not familiar with pickle, pandas, and numpy, I'm having a very hard time trying to do that.
The content of the pkl file is something like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
{ 'woodi' : array([ - 0.07377538 , 0.01810472 , 0.03796827 , - 0.01185564 , - 0.12605625 , - 0.03709966 , 0.07863396 , 0.04245366 , - 0.09158159 , - 0.01418831 , - 0.03165198 , - 0.01235643 , 0.00833164 , - 0.08156401 , - 0.10466748 , 0.11343367 , - 0.1291647 , 0.02277501 , - 0.12230705 , 0.08400519 , 0.01631752 , - 0.03204752 , - 0.10115118 , 0.01796065 , - 0.08914784 , 0.00336748 , 0.02858992 , 0.13387977 , - 0.01711662 , - 0.05058149 , 0.09866285 , 0.00623399 , - 0.11368696 , 0.03389056 , 0.03049786 , - 0.11235228 , 0.03964651 , 0.18348881 , 0.00356622 , - 0.09299972 , 0.11804404 , 0.10598116 , 0.04603285 , 0.10211086 , - 0.07094006 , 0.19667923 , - 0.22645354 , - 0.02930884 , - 0.21891772 , - 0.07495865 ]), 'bad-boy' : array([ - 0.01525861 , - 0.0145514 , 0.02207321 , 0.01273549 , 0.0034881 , - 0.00045474 , 0.01104943 , 0.00057228 , - 0.01515725 , 0.00329882 , 0.01570324 , - 0.03927545 , 0.00393151 , 0.00355666 , - 0.00503297 , - 0.01088151 , - 0.0354947 , - 0.010477 , - 0.01945165 , 0.0312498 , 0.00195288 , - 0.03095445 , - 0.00803227 , 0.02864361 , - 0.01416729 , 0.00375061 , 0.00546439 , 0.03621898 , 0.01337988 , - 0.03205173 , 0.00451094 , 0.02180656 , - 0.02587242 , - 0.01276209 , 0.02721113 , - 0.00075289 , - 0.00218841 , 0.00531534 , - 0.0074188 , 0.00312647 , 0.00424174 , 0.02444418 , 0.0222739 , - 0.00477895 , 0.02220114 , 0.03402764 , - 0.02423164 , 0.00724037 , - 0.03526915 , 0.01470344 ]), ... } |
The content of the csv file must look like:
Output:woodi -0.07377538 0.01810472 ... -0.07495865
bad-boy -0.01525861, -0.0145514 ... 0.01470344
Can anybody please help me?Thanks a lot!
Cheers,
Jonn