It seems you have no Values but values column, so need add [] because collision with values function.

Sample:

df = pd.DataFrame ({'values': [1,2,3,4,np.nan,8] })
print (df)
   values
0     1.0
1     2.0
2     3.0
3     4.0
4     NaN
5     8.0

#return numpy array
print (df.values)
[[  1.]
 [  2.]
 [  3.]
 [  4.]
 [ nan]
 [  8.]]

#select column values
print (df['values'])
0    1.0
1    2.0
2    3.0
3    4.0
4    NaN
5    8.0
Name: values, dtype: float64

Your solution for me works nice, I also change .Values to ['Values'].

df1 = df.groupby('Label').filter(lambda x: x['Values'].count() > 1)
print (df1)
  Label  Values
0     A     1.0
1     A     2.0
3     C     4.0
4     C     NaN
5     C     8.0

Alternative solution with transform and boolean indexing:

print (df.groupby('Label')['Values'].transform('count'))
0    2.0
1    2.0
2    1.0
3    2.0
4    2.0
5    2.0
Name: Values, dtype: float64

print (df.groupby('Label')['Values'].transform('count') > 1)
0     True
1     True
2    False
3     True
4     True
5     True
Name: Values, dtype: bool

print (df[df.groupby('Label')['Values'].transform('count') > 1])
  Label  Values
0     A     1.0
1     A     2.0
3     C     4.0
4     C     NaN
5     C     8.0

Also check What is the difference between size and count in pandas?

Answer from jezrael on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 72675131 › attributeerror-numpy-ndarray-object-has-no-attribute-value-countswhile-plot
machine learning - AttributeError: 'numpy.ndarray' object has no attribute 'value_counts'while plotting bar plot - Stack Overflow
You are trying to call this method on a Numpy type, which is not provided by numpy. The value_counts method is supported by Pandas library for DataFrames. Try to change your code to the following and it might work: y = reviews['Score'] The type ...
Discussions

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
python - How do I count the occurrence of a certain item in an ndarray? - Stack Overflow
In this case, it is also possible to simply use numpy.count_nonzero. Mong H. Ng – Mong H. Ng · 2019-03-31 17:50:21 +00:00 Commented Mar 31, 2019 at 17:50 ... Numpy has a module for this. Just a small hack. More on stackoverflow.com
🌐 stackoverflow.com
pandas - 'numpy.ndarray' object has no attribute 'plot' - Data Science Stack Exchange
I am trying to balance my data set and using imblearn library for this but After performing fit operation when i try to see the data count in dependent variable its showing me below error Attribute... More on datascience.stackexchange.com
🌐 datascience.stackexchange.com
March 29, 2020
AttributeError: 'numpy.ndarray' object has no attribute 'pop'
Well, NumPy arrays do not have a .pop() method; those are on regular Python lists instead. You seem to use this for omitting grades less than 5. Maybe NumPy's boolean indexing could work here, e.g. marks = np.array([ [8.0, 9.0, 10.0], [4.0, 9.0, 8.0], [8.0, 3.0, 8.0], [10.0, 9.0, 5.0], [9.0, 9.0, 4.0] ]) omitted_5 = np.array([ row[~(row < 5)] # Keep those that are NOT less than 5 for row in marks ]) # array([array([ 8., 9., 10. ]), # array([ 9., 8. ]), # array([ 8., 8. ]), # array([ 10., 9., 5. ]), # array([ 9., 9. ])], # dtype=object) However, this results in an irregularly shaped data, which interferes with the GPA computation with credits. QUESTION: How would marks with omitted values behave with the GPA computation? For example, the last set of marks [9.0, 9.0, 4.0] which will essentially be filtered into [9.0, 9.0] Will it only get multiplied to [2, 2]? (Filtered credits values) Or should it instead be filtered into [9.0, 9.0, 0.0] and fully multiplied with [2, 2, 1]? (Unfiltered credits) More on reddit.com
🌐 r/learnpython
4
1
November 28, 2022
🌐
Stack Overflow
stackoverflow.com › questions › 28663856 › how-do-i-count-the-occurrence-of-a-certain-item-in-an-ndarray
python - How do I count the occurrence of a certain item in an ndarray? - Stack Overflow
In this case, it is also possible to simply use numpy.count_nonzero. Mong H. Ng – Mong H. Ng · 2019-03-31 17:50:21 +00:00 Commented Mar 31, 2019 at 17:50 ... Numpy has a module for this. Just a small hack.
🌐
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
Answer: The error is exactly what it says on the tin: NumPy’s ndarray object has no attribute [code ]append[/code] defined in its API. The error in question, for reference. We can start by asking, what is a numpy.ndarray? NumPy is an incredibly useful library for data manipulation in Python, wh...
🌐
IQCode
iqcode.com › code › python › numpyndarray-object-has-no-attribute-count
'numpy.ndarray' object has no attribute 'count' Code Example
January 30, 2022 - &gt;&gt;&gt; a = numpy.array([0, 3, 0, 1, 0, 1, 2, 1, 0, 0, 0, 0, 1, 3, 4]) &gt;&gt;&gt; unique, counts = numpy.unique(a, return_counts=True) &gt;&gt;&gt; dict(zip(unique, counts)) {0: 7, 1: 4, 2: 1, 3: 2, 4: 1} ... Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond. Sign up · Develop soft skills on BrainApps Complete the IQ Test ... AttributeError: 'numpy.ndarray' object has no attribute 'show' 'numpy.ndarray' object has no attribute 'get' AttributeError: module 'numpy' has no attribute 'ndarray'\ 'numpy.ndarray' object has no attribute 'num_examples' '
🌐
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.
Find elsewhere
🌐
IQCode
iqcode.com › code › other › attributeerror-numpyndarray-object-has-no-attribute-value-counts
AttributeError: 'numpy.ndarray' object has no attribute 'value_counts' Code Example
August 29, 2021 - &gt;&gt;&gt; a = numpy.array([0, 3, 0, 1, 0, 1, 2, 1, 0, 0, 0, 0, 1, 3, 4]) &gt;&gt;&gt; unique, counts = numpy.unique(a, return_counts=True) &gt;&gt;&gt; dict(zip(unique, counts)) {0: 7, 1: 4, 2: 1, 3: 2, 4: 1} ... Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond. Sign up · Develop soft skills on BrainApps Complete the IQ Test ... AttributeError: 'numpy.ndarray' object has no attribute 'show' 'numpy.ndarray' object has no attribute 'get' AttributeError: module 'numpy' has no attribute 'ndarray'\ 'numpy.ndarray' object has no attribute 'num_examples' '
🌐
Reddit
reddit.com › r/learnpython › attributeerror: 'numpy.ndarray' object has no attribute 'pop'
r/learnpython on Reddit: AttributeError: 'numpy.ndarray' object has no attribute 'pop'
November 28, 2022 -

Write a function to calculate accumulated GPA (omit grade <5).

def gpa_of_pass(marks, credits):
    gpa_list=[]
    for i in range(len(marks)):
        for j in range(len(marks[i])):
            if marks[i][j] < 5:
                marks=marks[i].pop(j)
    for i in marks:
        for j in i:
            gpa_list.append(np.dot(i,credits)/sum(credits))
    return gpa_list

marks = np.array([
    [8.0, 9.0, 10.0],
    [4.0, 9.0, 8.0],
    [8.0, 3.0, 8.0],
    [10.0, 9.0, 5.0],
    [9.0, 9.0, 4.0]
])

credits = np.array([2, 2, 1])
gpa_of_pass(marks, credits)

I ran a for loop to remove the grade <5 before calculating the GPA but I got the error in the title. Would you please have any suggestions? Thank you so much!

🌐
HatchJS
hatchjs.com › home › numpy ndarray object has no attribute ‘count’: how to fix this error
Numpy ndarray object has no attribute 'count': How to fix this error
January 5, 2024 - A: This error message means that the numpy.ndarray object you are trying to use does not have the `count` attribute. This could be because the object is not a numpy array, or because the attribute has been removed from the object.
🌐
PyTorch Forums
discuss.pytorch.org › vision
AttributeError: 'numpy.ndarray' object has no attribute 'numpy' - vision - PyTorch Forums
April 9, 2019 - @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 ...
🌐
The Tools Trunk
thetoolstrunk.com › home › attributeerror: ‘numpy ndarray’ object has no attribute ‘value_counts’ | fixes that work now
AttributeError: 'NumPy NdArray' Object Has No Attribute 'Value_Counts' | Fixes That Work Now
November 23, 2025 - Look For .values Or .to_numpy() Upstream — If you see it right before value_counts(), remove it or move value_counts() earlier in the chain. Confirm The Object Type — Add type(obj) in a quick print or debugger watch. If it reads numpy.ndarray, wrap it with pd.Series before counting.
🌐
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
🌐
Stack Overflow
stackoverflow.com › questions › 68271353 › attributeerror-numpy-ndarray-object-has-no-attribute-value-counts
AttributeError: 'numpy.ndarray' object has no attribute 'value_counts' - Stack Overflow
July 6, 2021 - Somewhere in your code, you're calling arr.value_counts() where arr is expected to be a pandas.Series but was a numpy.array instead.
🌐
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