Python Forum
Spyder: ndarray object of numpy module error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spyder: ndarray object of numpy module error
#1
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.
Reply
#2
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
Reply
#3
(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.
Reply
#4
How did you solve the error ?
Reply
#5
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.
Reply
#6
(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
Reply
#7
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Singular error with numpy.linalg.inv LennartLindner 1 10,743 Oct-04-2020, 05:15 AM
Last Post: scidam
  Integer object error Zatoichi 2 3,690 Feb-18-2018, 07:25 AM
Last Post: Zatoichi
  Saving an numpy.ndarray as .ply file in python Tina 4 16,986 Oct-11-2017, 06:08 PM
Last Post: Tina
  error 'ring' is not a callable object JakeWitten 1 3,011 May-02-2017, 05:09 AM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020