[Tutor] NumPy Generates ValueError: Some errors were detected ! Line #9 (got 42 columns instead of 1)
Alan Gauld
alan.gauld at btinternet.com
Sun Sep 29 04:21:56 EDT 2019
On 29/09/2019 01:44, David wrote:
> On Sun, 29 Sep 2019 at 02:36, Stephen P. Molnar <s.molnar at sbcglobal.net> wrote:
>> On 09/27/2019 12:22 PM, Alan Gauld via Tutor wrote:
>>
>> Thank you for your reply. There are, in fact, hidden characters in the
>> input file (cat -A ...):
>>
>>> ^IRMSD TABLE$
>>> ^I__________$
>>> $
>>> _____________________________________________________________________$
>>> | | | | | |$
>>> Rank | Sub- | Run | Binding | Cluster | Reference | Grep$
>>> | Rank | | Energy | RMSD | RMSD | Pattern$
>>> _____|______|______|___________|_________|_________________|___________$
>>> 1 1 8 -7.23 0.00 93.07 RANKING$
>>> 1 2 9 -6.79 1.39 92.64 RANKING$
>>>
>>> But I wonder why you say "There are, in fact, hidden characters in the
>>> input file".
>>>
>>> Are you aware that '^I' is how 'cat -A' represents a tab
>>> character, and that '$' is how it represents a newline character?
The hidden characters from my perspective were the spaces betweenthe fields.
In the original post I saw:
|RMSD TABLE __________
_____________________________________________________________________
||||||Rank|Sub-|Run|Binding|Cluster|Reference|Grep|Rank||Energy|RMSD
|RMSD
|Pattern_____|______|______|___________|_________|_________________|___________
118-7.230.0093.07RANKING 129-6.791.3992.64RANKING
2116-7.180.0093.19RANKING 312-6.930.0093.38RANKING
So it looked like the field separator was the periods.
Which, coincidentally, led to 7 fields exactly as the error
message stated.
Seeing the spaces gives an entirely different view of the data!
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list