question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

genfromtxt with names=True doesn't skip comments

See original GitHub issue

If numpy.genfromtxt() is called with names=True, as is the case with numpy.recfromcsv(), then the comment lines are ignored. This is due to the following code block:

    # Keep on until we find the first valid values
    first_values = None
    try:
        while not first_values:
            first_line = next(fhd)
            if names is True:
                if comments in first_line:
                    first_line = asbytes('').join(first_line.split(comments)[1:])
            first_values = split_line(first_line)

Is this the intended behavior? It seems like comments should be read and ignored regardless if names is True.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rgommerscommented, Aug 17, 2019

btw, is there a policy written up on labeling?

Not yet, it’s on my TODO list - I actually have a rough draft for SciPy based on our recent triage effort there. So far all your comments have been spot on, so please imagine there’s a policy in line with what you did over the past couple of days:)

I can’t commit to do this regularly, but nevertheless I’m trying to do some occasional triaging to upstream packages.

No commitments of course, we’re all volunteers (well, almost all)! Your efforts are much appreciated:)

1reaction
rgommerscommented, Aug 16, 2019

thanks @bsipocz. triaging these old issues is quite useful. I’ll send you an invite for the triage team, so you can add labels, and close issues yourself if something is clearly fixed or invalid.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Numpy genfromtxt doesn't seem to work when names=True for ...
With my_data = genfromtxt('DlRefinedRatings.csv', delimiter=',' , dtype=int, max_rows=100). I got a (100,4) int array. With names=True it ...
Read more >
Importing data with genfromtxt — NumPy v1.25.dev0 Manual
There is one notable exception to this behavior: if the optional argument names=True , the first commented line will be examined for names....
Read more >
Importing data with genfromtxt — NumPy v1.9 Manual
There is one notable exception to this behavior: if the optional argument names=True, the first commented line will be examined for names. Skipping...
Read more >
NumPy Input and Output: genfromtxt() function - w3resource
Data type of the resulting array. If None, the dtypes will be determined by the contents of each column, individually. dtype, Optional. comments...
Read more >
Reading Text Tables with Python - Pen and Pants
That can be useful if you want to skip a text column. ... If you set names=True numpy.genfromtxt will take the column names...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found