Python Forum

Full Version: Spyder: ndarray object of numpy module error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I am going through the ML A-Z course on udemy to help me solve an assignment and I am at the stage of preprocessing my data at the moment. My code is as below:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

dataset = pd.read_csv('Data.csv')
X = dataset.iloc[:,:-1].values
y = dataset.iloc[:,3].values
When I run the lines, my variable window can't seem to display the values of the X and y array and instead shows ndarray object of numpy module. When I double click on X or y, an error dialog pops up saying object arrays are currently not supported. What do I need to do to solve this problem? Is it okay to ignore it and continue coding?

I have already upgraded Spyder to the latest version as well but the problem remains.

Thank you.
i was able to solve this issue on my own. it is a known problem while using Spyder but it's not an issue that will affect the code so I have ignored the error
(Jan-12-2018, 06:57 PM)python_newbie09 Wrote: [ -> ]i was able to solve this issue on my own. it is a known problem while using Spyder but it's not an issue that will affect the code so I have ignored the error
How did you solve it? I have the same problem, my y-axes cant be loaded.
How did you solve the error ?
Just got this from Udemy... Most probably you version of Spyder cannot support the viewing of a numpy array with more than 1 type of elements. You will need to print this variable into the console to view it's contents. So just: print(X) and it's there.
(Dec-19-2018, 09:59 AM)joro Wrote: [ -> ]
(Jan-12-2018, 06:57 PM)python_newbie09 Wrote: [ -> ]i was able to solve this issue on my own. it is a known problem while using Spyder but it's not an issue that will affect the code so I have ignored the error
How did you solve it? I have the same problem, my y-axes cant be loaded.

Sorry I was not here for a while. I hope you found the solution. It had something to do with the Spyder version if I remember correctly
dataset = pd.read_csv('50_Startups.csv')
X = dataset.iloc[:, :-1]
Y = dataset.iloc[:, 4]

=> Remove .values and it will work
=> But this will just create a dataframe of those datasets and not objects so choose wisely