adv_ex is already a numpy array, so you can’t call .numpy() again on it (which is a tensor method). Store adv_ex as a tensor or avoid calling numpy on it: adv_ex = perturbed_data.squeeze().detach().cpu() adv_examples.append( (init_pred.item(), final_pred.item(), adv_ex) ) Answer from ptrblck on discuss.pytorch.org
🌐
Stack Overflow
stackoverflow.com › questions › 79277996 › attributeerror-numpy-ndarray-object-has-no-attribute-categories
python - AttributeError: 'numpy.ndarray' object has no attribute 'categories' - Stack Overflow
What I’ve Tried: Switching to loc[pd.notnull(...)]: I confirmed that using X = X.loc[pd.notnull(X[key])] avoids the issue and the merge works correctly. Testing with other filtering methods: Other ways of filtering (like dropna with different columns or without categorical types) do not trigger the error.
Discussions

AttributeError: 'numpy.ndarray' object has no attribute 'float'
Hi, I’m using dqn for my custom multi-agent env. I can test my evn with trainer and tune, both work without any error. After just a few training iterations, I would like to see the agent’s performance with compute_action. But I get the following error: AttributeError: 'numpy.ndarray' object ... More on discuss.ray.io
🌐 discuss.ray.io
2
0
September 19, 2021
scikit learn - AttributeError: 'numpy.ndarray' object has no attribute 'fit' - Data Science Stack Exchange
I am relatively new to ML and in the process of learning pipelines. I am creating a pipeline of custom transformers and get this error: AttributeError: 'numpy.ndarray' object has no attribute 'fit'. More on datascience.stackexchange.com
🌐 datascience.stackexchange.com
September 24, 2021
'numpy.ndarray' object has no attribute 'numpy'.
I tried to submit this to the repository linked in your publication, but, apparently, I can't! I received this error while running predictions: Traceback (most recent call last): File "/Us... More on github.com
🌐 github.com
1
November 16, 2023
Medical Data Visualizer AttributeError: 'numpy.ndarray' object has no attribute
I completed the project on google colab and everything seems to be working once I copy it over to replit. The charts seem to look good. However, I’m getting the following 2 errors on test: ====================================================================== ERROR: test_bar_plot_number_of_bars ... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
1
0
May 11, 2023
🌐
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

🌐
GeeksforGeeks
geeksforgeeks.org › 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.
🌐
Itsourcecode
itsourcecode.com › home › attributeerror: numpy.ndarray object has no attribute values
Attributeerror: numpy.ndarray object has no attribute values
April 4, 2023 - This attributeerror: numpy.ndarray object has no attribute values error occurs when you try to access the “values” attribute of a NumPy ndarray object, but it does not exist.
Find elsewhere
🌐
GitHub
github.com › waylandy › phosformer › issues › 1
'numpy.ndarray' object has no attribute 'numpy'. · Issue #1 · waylandy/phosformer
November 16, 2023 - Traceback (most recent call last): File "/Users/joshuasacher/phosformer/wip1_S234.py", line 17, in <module> predictions = Phosformer.predict_many( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/joshuasacher/phosformer/Phosformer/modules.py", line 204, in predict_many return np.array([i['pred'] for i in batch_job(kinases, peptides, **kwargs)]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/joshuasacher/phosformer/Phosformer/modules.py", line 204, in <listcomp> return np.array([i['pred'] for i in batch_job(kinases, peptides, **kwargs)]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/joshuasacher/phosformer/Phosformer/modules.py", line 96, in batch_job pred = softmax(result['logits'].cpu(), axis=1)[:,1].numpy() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'numpy.ndarray' object has no attribute 'numpy'.
Author   jrsacher
🌐
GitHub
github.com › modin-project › modin › issues › 7580
BUG: Conversion of Modin to Pandas causes "AttributeError: 'numpy.ndarray' object has no attribute 'categories'" · Issue #7580 · modin-project/modin
May 23, 2025 - BUG: Conversion of Modin to Pandas causes "AttributeError: 'numpy.ndarray' object has no attribute 'categories'"#7580
Published   May 23, 2025
Author   Sumukhagc
🌐
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 AttributeError: ‘numpy.ndarray’ object has no attribute ‘append’ error is caused by using the append() method to add an item to a NumPy array.
🌐
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
Summary The AttributeError is simply because ndarray has no append method. Choose the appropriate container or numpy function for your use case: list for frequent appends, preallocation for efficiency, or np.append/np.concatenate when copying ...
🌐
Neurostars
neurostars.org › community chat
AttributeError: 'numpy.ndarray' object has no attribute 'func' - Community Chat - Neurostars
September 1, 2022 - Hello, I am working on a subject on my local pc I did preprocessing through fmriprep on docker. I used the when I wanted to run import nibabel as nib from nibabel.testing import data_path import numpy as np from nilearn import datasets atlas = datasets.fetch_atlas_msdl() Loading atlas image stored in ‘maps’ atlas_filename = atlas[‘maps’] Loading atlas data stored in ‘labels’ labels = atlas[‘labels’] Load the functional datasets a = nib.load(’/home/roya/outputneww2/sub-1001/ses-01/...
🌐
Edureka Community
edureka.co › home › community › categories › python › attributeerror type object numpy ndarray has...
AttributeError type object numpy ndarray has no attribute array function | Edureka Community
April 13, 2020 - Hi Guys, I installed numpy module in my system. But when I tried to import this module ... '__array_function__' How can I solve this error?
🌐
MNE Forum
mne.discourse.group › support & discussions
AttributeError: 'numpy.ndarray' object has no attribute 'get' - Support & Discussions - MNE Forum
May 17, 2021 - MNE-Python version: 0.23.0 operating system: Ubuntu 18.04.5 LTS -IDE: Pycharm-community import matplotlib import matplotlib.pyplot as plt import mne import numpy matplotlib.use('Qt5Agg') mne.set_log_level('warning') # Load raw data data_path = '/MNE/BrainVision/3.vhdr' raw = mne.io.read_raw_brainvision(data_path, preload=True, verbose=False) raw.info['line_freq'] = 50.
🌐
Brainly
brainly.com › computers and technology › high school › how can you fix the attributeerror: 'numpy.ndarray' object has no attribute 'append'?
[FREE] How can you fix the AttributeError: 'numpy.ndarray' object has no attribute 'append'? - brainly.com
November 19, 2023 - To fix the 'AttributeError: 'numpy.ndarray' object has no attribute 'append'', use the 'numpy.append()' function instead of the 'append' method. NumPy arrays do not support the 'append' method as their size is fixed.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-fix-numpy-ndarray-object-has-no-attribute-append
How to Fix: ‘numpy.ndarray’ object has no attribute ‘append’ - GeeksforGeeks
November 28, 2021 - In the above output, we can see that the python list has a data type of list. When we perform the append operation, the item i.e., 5 gets appended to the end of the list `pylist`. While we try the same method for the NumPy array, it fails and throws an error "AttributeError: 'numpy.ndarray' object has no attribute 'append'".
🌐
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.