It takes a dict as the second argument not an array:

From the docs:

mdict : dict

Dictionary from which to save matfile variables.

I am not overly familiar but I imagine you pass the name as the key and the array as the value, something like:

sio.savemat('final.mat',{"foo":temp})
Answer from Padraic Cunningham on Stack Overflow
🌐
GitHub
github.com › ray-project › ray › issues › 17706
[rllib] "AttributeError: 'numpy.ndarray' object has no attribute 'items'" on certain turn-based MultiAgentEnvs with Dict obs space. · Issue #17706 · ray-project/ray
August 10, 2021 - [rllib] "AttributeError: 'numpy.ndarray' object has no attribute 'items'" on certain turn-based MultiAgentEnvs with Dict obs space.#17706
Author   akshaygh0sh
Discussions

AttributeError: 'numpy.ndarray' object has no attribute 'numpy'
@ptrblck, Hi! I’m trying to visualize the adversarial images generated by this script: https://pytorch.org/tutorials/beginner/fgsm_tutorial.html This tutorial is used for the mnist data. Now I want to use for other data which is trained using the inception_v1 architecture, below is the gist ... More on discuss.pytorch.org
🌐 discuss.pytorch.org
12
0
April 9, 2019
Error creating numpy v-stack, 'AttributeError: 'numpy.ndarray' object has no attribute 'np'
I think I'm using the wrong notation to append to the empty arrays: The best way to find out is to read the documentation https://numpy.org/doc/stable/reference/generated/numpy.append.html And yes you are. Numpy arrays don't have an append method, it's a function from the library. And there is no such thing as object.library.function(...) which is what you are doing here similarity.np.append(...) num_interactions.np.append(...) It should be similarity = np.append(similarity, values_to_append) num_interactions = np.append(num_interactions, values_to_append) And should avoid appending data to a numpy array. I'm almost sure there is much better alternative. But since you didn't explain what you are trying to do, I can't help you with that. More on reddit.com
🌐 r/learnpython
5
2
May 4, 2021
AttributeError: 'numpy.ndarray' object has no attribute 'items'. Did you mean: 'item'?
i'm trying to connect dreamerv3 to a unity environment (which provides a gym interface) but i get the following error: Logdir logdir\unity Create envs. config.envs: 1 make_env() suite == unity ... More on github.com
🌐 github.com
2
July 31, 2024
AttributeError: 'numpy.ndarray' object has no attribute 'dim'
Hello Team, i am new to the forum and to Pytorch, i want to predict 3 real values Y1, Y2 & Y3 from input values X1, X2…X10 using the below model, but i get the error in title: File “/home/abdelmoula/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py”, line 833, in linear if ... More on discuss.pytorch.org
🌐 discuss.pytorch.org
0
0
April 5, 2018
🌐
Statology
statology.org › home › how to fix: ‘numpy.ndarray’ object has no attribute ‘index’
How to Fix: 'numpy.ndarray' object has no attribute 'index'
September 17, 2021 - This error occurs when you attempt to use the index() function on a NumPy array, which does not have an index attribute available to use.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-fix-numpy-ndarray-object-has-no-attribute-index
How to Fix: ‘numpy.ndarray’ object has no attribute ‘index’ - GeeksforGeeks
November 28, 2021 - ‘numpy.ndarray’ object has no attribute ‘index’ is an attribute error which indicates that there is no index method or attribute available to use in Numpy array.
🌐
Career Karma
careerkarma.com › blog › python › python attributeerror: ‘numpy.ndarray’ object has no attribute ‘append’ solution
Python AttributeError: 'numpy.ndarray' object has no attribute 'append' Solution
December 1, 2023 - ... The number 49 has been successfully added to the end of our list. The AttributeError: ‘numpy.ndarray’ object has no attribute ‘append’ error indicates you are using the regular Python append() method to add an item to a NumPy array.
🌐
Reddit
reddit.com › r/learnpython › error creating numpy v-stack, 'attributeerror: 'numpy.ndarray' object has no attribute 'np'
r/learnpython on Reddit: Error creating numpy v-stack, 'AttributeError: 'numpy.ndarray' object has no attribute 'np'
May 4, 2021 -

Hi,

I'm trying to create a numpy v-stack and creating 3 np.array's for it, by filling them with a loop:

I get the error: 'AttributeError: 'numpy.ndarray' object has no attribute 'np' . I think I'm using the wrong notation to append to the empty arrays:

neighbor_id = [id_ for id_ in range(1, n_obs) if id_ != user_id]

neighbor_id_arr = np.array(neighbor_id)

similarity = np.array([])

num_interactions = np.array([])

# get similarity and num_interactions

for id_ in neighbor_id:

similarity.np.append(np.dot(user_item.loc[user_id],user_item.loc[id_])) #The issue is here, I think

num_interactions.np.append(user_interactions.loc[id_])

c = numpy.vstack((neighbor_id_arr, similarity,num_interactions))

Thanks!
James

Find elsewhere
🌐
Quora
quora.com › Why-do-I-get-numpy-ndarray-object-has-no-attribute-append-error
Why do I get “numpy.ndarray object has no attribute append error”? - Quora
This error occurs because numpy.ndarray objects do not implement the list method append — numpy arrays have a fixed size and their API differs from Python lists. Calling arr.append(...) raises AttributeError.
🌐
PyTorch Forums
discuss.pytorch.org › t › attributeerror-numpy-ndarray-object-has-no-attribute-dim › 16026
AttributeError: 'numpy.ndarray' object has no attribute 'dim' - PyTorch Forums
April 5, 2018 - Hello Team, i am new to the forum and to Pytorch, i want to predict 3 real values Y1, Y2 & Y3 from input values X1, X2…X10 using the below model, but i get the error in title: File “/home/abdelmoula/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py”, line 833, in linear if input.dim() == 2 and bias is not None: AttributeError: ‘numpy.ndarray’ object has no attribute ‘dim’ Can you please on what is wrong ? thank you ######################## MODEL: import pandas as pd import to...
🌐
GitHub
github.com › Zulko › moviepy › issues › 2103
AttributeError: 'numpy.ndarray' object has no attribute 'read'
January 27, 2024 - AttributeError Traceback (most recent call last) [/usr/local/lib/python3.10/dist-packages/PIL/Image.py](https://localhost:8080/#) in open(fp, mode, formats) 2978 try: -> 2979 fp.seek(0) 2980 except (AttributeError, io.UnsupportedOperation): AttributeError: 'numpy.ndarray' object has no attribute 'seek' During handling of the above exception, another exception occurred: AttributeError Traceback (most recent call last) 11 frames <decorator-gen-178> in set_make_frame(self, mf) <decorator-gen-128> in get_frame(self, t) [/usr/local/lib/python3.10/dist-packages/PIL/Image.py](https://localhost:8080/#) in open(fp, mode, formats) 2979 fp.seek(0) 2980 except (AttributeError, io.UnsupportedOperation): -> 2981 fp = io.BytesIO(fp.read()) 2982 exclusive_fp = True 2983 AttributeError: 'numpy.ndarray' object has no attribute 'read' !wget -c https://cdn.creatomate.com/demo/mountains.mp4 ·
Author   sugizo
🌐
GitHub
github.com › lmcinnes › umap › issues › 894
AttributeError: 'numpy.ndarray' object has no attribute 'transform' · Issue #894 · lmcinnes/umap
July 27, 2022 - Hello, When trying to do a .fit_transform on the "Train" data and then a .transform on the "Test" data, I get the error: AttributeError: 'numpy.ndarray' object has no attribute 'transform' This is my use case: reducer = umap.UMAP( n_comp...
Author   rbsingh13
🌐
GitHub
github.com › Zulko › moviepy › issues › 2102
AttributeError: 'numpy.ndarray' object has no attribute 'point' · Issue #2102 · Zulko/moviepy
January 26, 2024 - AttributeError Traceback (most recent call last) [<ipython-input-6-e96ac98275c5>](https://localhost:8080/#) in <cell line: 1>() ----> 1 video0 = video0.fl_image(tes) 9 frames <decorator-gen-178> in set_make_frame(self, mf) <decorator-gen-128> in get_frame(self, t) [/usr/local/lib/python3.10/dist-packages/pilgram2/css/brightness.py](https://localhost:8080/#) in brightness(im, amount) 40 assert amount >= 0 41 ---> 42 return im.point(lambda x: round(x * amount)) AttributeError: 'numpy.ndarray' object has no attribute 'point'
Author   sugizo
🌐
MathWorks
mathworks.com › matlabcentral › answers › 638735-matlab-numpy-array-attributeerror-array-array-object-has-no-attribute-fromstring
Matlab numpy array: AttributeError: 'array.array' object has no attribute 'fromstring' - MATLAB Answers - MATLAB Central
November 6, 2020 - Martin's answer seemed promising, but I fear it exhibits the same issue in terms of how MATLAB is passing data to Python under the hood. getByteStreamFromArray() returns a row vector, which fails to make its way to Python with the same AttributeError. Has anyone actually gotten this to work on Python >= 3.9? I was actually able to create a Numpy array in Python 3.9 from within MATLAB using Numpy's fromstring() method.