Python code error [closed]

-1

I have a MAC and everything worked perfectly, I decided to install anaconda to see if it would help me in something and now I do not push my code anymore, 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?

    
asked by anonymous 24.09.2015 / 06:56

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 an attempt to use the 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)

Expected would be all entries 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.]])
    
24.09.2015 / 15:40
0

If the problem really started after installing the 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% w_th of%. If you return something different as the path to your anaconda installation then you will need to find where the anaconda was added to your $ PATH, probably in /usr/bin/python or ~/.bash_profile and remove the change.

    
27.09.2015 / 19:01