Python code error

Asked

Viewed 187 times

-1

I have a MAC and everything worked perfectly, I decided to install the anaconda to see if it would help me in something and now I no longer run my codes, I get the following error message:

File "/Users/claytonpereira/anaconda/lib/python3.4/site-Packages/numpy/lib/npyio.py", line 1692, in genfromtxt

raise Valueerror(errmsg)

Valueerror: Some errors Were Detected !

Line #4 (got 2 Columns Instead of 1)

Line #5 (got 3 Columns Instead of 1)

Line #7 (got 3 Columns Instead of 1)

Could someone tell me what I can do?

  • 3

    At the very least you’d have to include the code you’re breaking, and the way the question is formatted, it looks like you just passed on a chat question here.

2 answers

1

It’s hard to answer your question without seeing the snippet of code you’re trying to execute and the data you’re using.

But the error message you are seeing seems to be from an attempt to use the function numpy.genfromtext with content that does not have the correct number of columns, as in this example:

>>> import numpy
>>> numpy.genfromtxt(iter(['1', '1', '1 2', '1 2 3', '1 2 3']), skip_header=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/elias/.local/lib/python2.7/site-packages/numpy/lib/npyio.py", line 1692, in genfromtxt
    raise ValueError(errmsg)
ValueError: Some errors were detected !
    Line #3 (got 2 columns instead of 1)
    Line #4 (got 3 columns instead of 1)
    Line #5 (got 3 columns instead of 1)

All entries would be expected to have the same number of columns:

>>> numpy.genfromtxt(iter(['1 2 3', '1 2 3', '1 2 3', '1 2 3', '1 2 3']), skip_header=True)
array([[ 1.,  2.,  3.],
       [ 1.,  2.,  3.],
       [ 1.,  2.,  3.],
       [ 1.,  2.,  3.]])

0

If the problem really started after installing anaconda, most likely your scripts started using the wrong Python on your machine.

Open a new Terminal window and type which python. Normally, in OS X, this would return /usr/bin/python. If you return something different, such as the path to your anaconda installation then you will need to find where the anaconda was added to your $PATH, probably at ~/.bash_profile or ~/.bashrc and remove the change.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.