I have npy file which seems it is a numpy.ndarray, (array of object), I want to reach the values for a specific item. How can I do it? This picture shows a part of npy file content and for example I have to reach values for avgmotion:
-
Hi @Faezeh Rabbani, and welcome to Stack Overflow. Instead of posting a screenshot, please create a Minimum Reproducible Example of your question. Refer to the docs here: stackoverflow.com/help/minimal-reproducible-exampleJamie.Sgro– Jamie.Sgro2022-10-24 13:33:03 +00:00Commented Oct 24, 2022 at 13:33
-
I found my answer here Extract dictionary item from numpy ndarrayFaezeh Rabbani– Faezeh Rabbani2022-10-24 15:27:35 +00:00Commented Oct 24, 2022 at 15:27
Add a comment
|
1 Answer
it seems that the variable you're using is a dictionary.
You have to access to the values of the key : avgmotion by simply putting the information in variable, let's assume your dictionary's variable is name_of_dict.
avgmotion = name_of_dict["avgmotion"]
After that you can check the shape and size of your array and try to extract whatever data you want.
1 Comment
Faezeh Rabbani
this method showes me this error=> IndexError: only integers, slices (
:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices