New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: '(slice(None, None, None), slice(None, None, None))' is an invalid key #293
Comments
I'm having the same issue. How did you solve this? @dhariyalbhaskar |
I'm also having this issue. Any ideas? |
Hi @WetzlerkAI, I changed my input to a numpy array instead and it worked. I have still not been able to sort this issue with a Pandas dataframe input. If it is urgent in your case, I suggest changing your input to numpy and moving ahead. |
@WetzlerkAI I had the same problem. I fixed it by converting the dataframe to a numpy array and changing my variable assignments accordingly. Fist bump to @naanunaane! |
X_train is a Pandas DataFrame. In Pandas you can use X_train.iloc[:,:] and that fixes the issue, but I think it is the same as X_train without any indexing. If you would like to get the Numpy array from a Pandas DataFrame you can use X_train.values . In this case you again can use your type of indexing like X_train.values[:,:] I think it does not depend on Python version. |
Use like data_frame_name.iloc[:,1:4] for all rows and 1,2 and 3 columns |
You have to always use "iloc" to slice a pandas array |
Current best practice would be to use Source: |
I'm facing mentioned issue. I initially thought the issue is due to version of python I was using i.e python3, but I tried to used it with python2, the same error pops up.
The text was updated successfully, but these errors were encountered: