Bottom Page

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.
Quote
#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
Quote
#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.
Quote
#4
How did you solve the error ?
Quote
#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.
Quote
#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
Quote
#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
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [supernoob2] Trying Numpy and THIS happened... sidon 2 115 Jul-24-2019, 03:46 PM
Last Post: sidon
  Sort Matrices by Mean Value Obtained (OpenCV, Python and Numpy) danny_paez 1 208 May-03-2019, 12:21 PM
Last Post: scidam
  getting an error"Line 7: TypeError: 'int' object is not callable" JTNA 4 368 Apr-03-2019, 01:58 PM
Last Post: JTNA
  homeworking using only numpy package kirito85 4 505 Dec-21-2018, 08:23 AM
Last Post: kirito85
  Changing "import numpy as np" to "from numpy import" ClintWestwood 4 980 Nov-28-2018, 06:45 AM
Last Post: nilamo
  Numpy array delete cells LB_994 1 511 Nov-19-2018, 09:20 AM
Last Post: ThiefOfTime
  numpy help: Uniform order-based crossover Mass17 0 390 Oct-18-2018, 10:05 PM
Last Post: Mass17
  How to stop an infinite loop in spyder if it's currently running? wlsa 3 6,476 Jun-30-2018, 03:27 AM
Last Post: ichabod801
  Integer object error Zatoichi 2 1,025 Feb-18-2018, 07:25 AM
Last Post: Zatoichi
  Spyder Assignment 1 Coursera Illvoices 2 801 Feb-08-2018, 05:18 AM
Last Post: Illvoices

Forum Jump:


Users browsing this thread: 1 Guest(s)