The problem lies in the following line:

df = StandardScaler().fit_transform(df) 

It returns a numpy array (see docs), which does not have a drop function. You would have to convert it into a pd.DataFrame first!

new_df = pd.DataFrame(StandardScaler().fit_transform(df), columns=df.columns, index=df.index)
Answer from tobsecret on Stack Overflow
🌐
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

Discussions

python - 'numpy.ndarray' object has no attribute 'drop' - Stack Overflow
I have a dataset with four inputs named X1, X2, X3, X4. Here I created the lstm model to predict next X1 value with the previous values of four inputs. Here I changed the time into minutes and t... More on stackoverflow.com
🌐 stackoverflow.com
August 2, 2019
scikit learn - AttributeError: 'numpy.ndarray' object has no attribute 'columns' - Data Science Stack Exchange
import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split from sklearn.feature_selection import SelectFromModel... More on datascience.stackexchange.com
🌐 datascience.stackexchange.com
June 21, 2019
Medical Data Visualizer Project Image Is Good but Errors Encountered
Hello, I finished the task on my replit that basically tells me to write python code that generates ‘bar’ graph and correlation matrix images using pandas and seaborn. While running the test_module.py, 2 errors were raised based on the former image result. More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
1
0
February 16, 2022
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
🌐
GitHub
github.com › oegedijk › explainerdashboard › issues › 95
AttributeError: 'numpy.ndarray' object has no attribute 'columns' · Issue #95 · oegedijk/explainerdashboard
March 3, 2021 - This looks amazing but I can't run it on my dataset. I get the following error: runfile('E:/Machine Learning Projects/ML UFC/genetic_algorithm_cluster_UFC_database_TPOT.py', wdir='E:/Machine Learning Projects/ML UFC') Traceback (most rec...
Author   apavlo89
🌐
Researchdatapod
researchdatapod.com › home › how to solve python attributeerror: ‘numpy.ndarray’ object has no attribute ‘drop’
How to Solve Python AttributeError: 'numpy.ndarray' object has no attribute 'drop' - The Research Scientist Pod
May 17, 2022 - AttributeError occurs in a Python program when we try to access an attribute (method or property) that does not exist for a particular object. The drop method is a DataFrame method, not a numpy.ndarray method that removes rows or columns by ...
🌐
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.
Find elsewhere
🌐
freeCodeCamp
forum.freecodecamp.org › python
Medical Data Visualizer Project Image Is Good but Errors Encountered - Python - The freeCodeCamp Forum
February 16, 2022 - Hello, I finished the task on my replit that basically tells me to write python code that generates ‘bar’ graph and correlation matrix images using pandas and seaborn. While running the test_module.py, 2 errors were rais…
🌐
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
🌐
Hugging Face
discuss.huggingface.co › 🤗transformers
Error occuring during usig .to_tf_dataset() - 🤗Transformers - Hugging Face Forums
December 9, 2023 - The continuation of the error:“AttributeError: module ‘numpy’ has no attribute ‘object’. np.object was a deprecated alias for the builtin object. To avoid this error in existing code, use object by itself. Doing this will not modify ...
🌐
Bobby Hadz
bobbyhadz.com › blog › python-attributeerror-module-numpy-has-no-attribute-array
AttributeError module 'numpy' has no attribute array or int | bobbyhadz
April 8, 2024 - ValueError: numpy.ndarray size changed, may indicate binary incompatibility · ValueError: x and y must have same first dimension, but have shapes · SystemError: initialization of _internal failed without raising an exception · ValueError: assignment destination is read-only [Solved] Could not broadcast input array from shape into shape [Fix] ValueError: object too deep for desired array [Solved]
🌐
Reddit
reddit.com › r/manim › attributeerror: 'numpy.ndarray' object has no attribute 'move_to'
r/manim on Reddit: AttributeError: 'numpy.ndarray' object has no attribute 'move_to'
August 13, 2020 -

Hello there.

I started doing manim a few weeks ago and, since there's no official documentation, I've been trying to replicate some of the scenes of 3b1b's old proyects. Specifically, I'm trying to replicate this animation ( https://www.youtube.com/watch?v=k7RM-ot2NWY at 0:37), but whenever I try to render the file, this error appears: "AttributeError: 'numpy.ndarray' object has no attribute 'move_to'".

I've already spend hours looking through the manimlib files but i can't make sense out of this.

Heres the code of the animation that I've got so far:

from manimlib.imports import *

class VectoresComoEscalares(VectorScene):
CONFIG = {
"axis_config": {
"stroke_color": WHITE,
"stroke_width": 2,
"stroke_opacity": 0.8,
},
"background_line_style": {"stroke_width": 2, "stroke_opacity": 0.5,},
"vcoords": ([3, 2]),
"vcolor": ORANGE,
}
def construct(self):
grid = NumberPlane(**self.CONFIG)
self.add(grid)
self.lock_in_faded_grid()
self.play(ShowCreation(grid), run_time=2)
self.wait()
kwargs = {
"stroke_width": 4,
}
vector = self.add_vector(self.vcoords, self.vcolor, **kwargs)
array, x_line, y_line = self.vector_to_coords(vector)
self.add(array)
self.wait()
new_array = self.ideas_generales_escalares(array, vector)
self.scale_basis_vectors(new_array)
self.show_symbolic_sum(new_array, vector)
def ideas_generales_escalares(self, array, vector):
startmo = self.get_mobjects()
txt = TextMobject(
"Vean cada coordenada como un escalar.", tex_to_color_map={"escalar": RED}
)
txt.to_edge(DOWN)
x, y = array.get_entries()
new_x = x.copy().scale(2).set_color(X_COLOR)
new_x.move_to(3 * LEFT + 2 * UP)
new_y = y.copy().scale(2).set_color(Y_COLOR)
new_y.move_to(3 * RIGHT + 2 * UP)
i_hat, j_hat = self.get_basis_vectors()
new_i_hat = Vector(self.vcoords[0] * i_hat.get_end(), color=X_COLOR)
new_j_hat = Vector(self.vcoords[1] * j_hat.get_end(), color=X_COLOR)
g1 = VGroup(i_hat, new_i_hat).shift(3 * LEFT)
g2 = VGroup(i_hat, new_j_hat).shift(3 * RIGHT)
new_array = Matrix([new_x.copy(), new_y.copy()])
new_array.scale(0.5)
new_array.shift(
-new_array.get_boundary_point(-vector.get_end()) + 1.1 * vector.get_end()
)
self.remove(*startmo)
self.play(Transform(x, new_x), Transform(y, new_y), Write(txt))
self.play(FadeIn(i_hat), FadeIn(j_hat))
self.wait()
self.play(FadeIn(i_hat), FadeIn(j_hat))
self.wait()
self.play(Transform(i_hat, new_i_hat), Transform(j_hat, new_j_hat), run_time=3)
self.wait()
startmo.remove(array)
new_x, new_y = new_array.get_entries()
self.play(
Transform(x, new_x),
Transform(y, new_y),
FadeOut(i_hat),
FadeOut(j_hat),
Write(new_array.get_brackets()),
FadeIn(VMobject(*startmo)),
FadeOut(txt),
)
self.remove(x, y)
self.add(new_array)
return new_array

🌐
PyTorch Forums
discuss.pytorch.org › t › attributeerror-numpy-ndarray-object-has-no-attribute-log › 117472
AttributeError: 'numpy.ndarray' object has no attribute 'log' - PyTorch Forums
April 8, 2021 - It seems you are trying to pass a numpy array to F.nll_loss, while a PyTorch tensor is expected. I’m not sure how y_pred is calculated, but note that using numpy array would detach them from the computation graph, so you should stick to PyTorch tensors and operations, if possible · Remove ...
🌐
GitHub
github.com › modin-project › modin › issues › 1376
AttributeError: 'numpy.ndarray' object has no attribute 'drain_call_queue' on groupby().sum() · Issue #1376 · modin-project/modin
April 18, 2020 - --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-15-081b1819b7d6> in <module> ----> 1 df.groupby(['DATA_SALDA', 'BANK', 'WALUTA_KON']).sum() ~/eksperyment/lib64/python3.6/site-packages/modin/pandas/groupby.py in sum(self, **kwargs) 323 324 def sum(self, **kwargs): --> 325 return self._groupby_reduce(lambda df: df.sum(**kwargs), None) 326 327 def describe(self, **kwargs): ~/eksperyment/lib64/python3.6/site-packages/modin/pandas/groupby.py in _groupby_reduce(self, map_func, reduce_func, drop, numeric_only,
Published   Apr 18, 2020
🌐
GitHub
github.com › pandas-dev › pandas › issues › 2948
AttributeError: 'numpy.ndarray' object has no attribute '_get_repr' with np.abs on a DatetimeIndex · Issue #2948 · pandas-dev/pandas
February 28, 2013 - AttributeError: 'numpy.ndarray' object has no attribute '_get_repr' with np.abs on a DatetimeIndex#2948
Author   robintw