I have a list named word_vector
whose every element is of type 'numpy.ndarray'.
print(word_vector)
output:
[array([0., 0., 0., ..., 0., 0., 0.]), array([0., 0., 0., ..., 0., 0., 0.]), array([0., 0., 0., ..., 0., 0., 0.]), array([0., 0., 0., ..., 0., 0., 0.])]
I want to convert the type of each element of the list to list. So I wrote this code:
word_vector_list = []
for arr in word_vector:
list_ = arr.tolist()
word_vector_list.append(list_)
print(word_vector_list)
The programming is getting hung repeatedly. I'm getting this exception:
IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.
Current values:
NotebookApp.iopub_data_rate_limit=1000000.0 (bytes/sec)
NotebookApp.rate_limit_window=3.0 (secs)
length of each element(of type array) of the list is:
print(len(arr))
output:
4395
I'm not entirely sure why your program is hanging. Try using list comprehension like so, it should be better:
word_vector_list = [list(x) for x in word_vector]
If it still didn't work, try increasing the iopub data rate. To increase the iopub data rate, run this in the terminal:
jupyter notebook --NotebookApp.iopub_data_rate_limit=1.0e10
Hope this helps:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.