AttributeError: 'numpy.ndarray' object has no attribute 'numpy'
python - AttributeError: 'numpy.ndarray' object has no attribute 'get' - Stack Overflow
tensorflow2.0 - 'numpy.ndarray' object has no attribute 'name' - Stack Overflow
scikit learn - AttributeError: 'numpy.ndarray' object has no attribute 'columns' - Data Science Stack Exchange
How do I fix 'NoneType object has no attribute'?
What is Python AttributeError and what causes it?
How do I prevent AttributeError from None values?
The problem is that train_test_split(X, y, ...) returns numpy arrays and not pandas dataframes. Numpy arrays have no attribute named columns
If you want to see what features SelectFromModel kept, you need to substitute X_train (which is a numpy.array) with X which is a pandas.DataFrame.
selected_feat= X.columns[(sel.get_support())]
This will return a list of the columns kept by the feature selector.
If you wanted to see how many features were kept you can just run this:
sel.get_support().sum() # by default this will count 'True' as 1 and 'False' as 0
because this :
X = df.iloc[:,:24481].values
y = df.iloc[:, -1].values
you should remove .values or make extra X_col, y_col like that
X_col = df.iloc[:,:24481]
y_col = df.iloc[:, -1]
Recoding Variables
"
#I need to recode variables given there are "5" responses present on a 4-point scale
scldict = {1:1,2:2,3:3,4:4,5:'NaN'}
w1array = np.array(week1)
w1vec = w1array.vectorize(scldict)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-92-e3f6056d2727> in <module>()
2 scaldict = {1:1,2:2,3:3,4:4,5:'NaN'}
3 w1array = np.array(week1)
----> 4 w1vec = w1array.vectorize(scaldict)
AttributeError: 'numpy.ndarray' object has no attribute 'vectorize'Hello world, I am trying to recode variables given there are invalid responses in my survey data. I am using a dictionary and the vectorize function (seen on StackOverflow) to do this. Why is the vectorize function not available? I am lost.
Any help or suggestions for recoding variables in an efficient manner would be appreciated.
https://imgur.com/gallery/yAdAjdx
Hello,
Linked is the screenshot of the two error messages I keep recieving as well as the code leading up to it. I'm trying to run an uplift on a classification tree. Any help is appreciated, I am still fairly new to python. Thank you!!
