10000 Allow file comments with genfromtxt(..., names=True) by khaeru · Pull Request #351 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Allow file comments with genfromtxt(..., names=True) #351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Allow file comments with genfromtxt(..., names=True) #351

wants to merge 2 commits into from

Conversation

khaeru
Copy link
@khaeru khaeru commented Jul 12, 2012

@travisbot
Copy link

This pull request fails (merged 9f45975 into 143fb18).

@khaeru
Copy link
Author
khaeru commented Jul 12, 2012

Ah. OK, so this change will not work with the following:

# gender age weight
M   21  72.100000
F   35  58.330000
M   33  21.99

(using the table from test_commented_header). But it will work with any of the following:

gender age weight # these are the headers
M   21  72.100000
F   35  58.330000
M   33  21.99
# here is a general file comment
# it is spread over multiple lines
gender age weight
M   21  72.100000
F   35  58.330000
M   33  21.99
# here is a general file comment
# the columns in this table are:
gender age weight
# following this line are the data:
M   21  72.100000
F   35  58.330000
M   33  21.99

etc. If this is an acceptable trade-off, I can rewrite the test.

@njsmith
Copy link
Member
njsmith commented Jul 13, 2012

So it sounds like there's a behavioural change here, where before we required header names to have a comment marker at the beginning and now we require them not to? Or something like that? Discussions about what behaviour we want belong on numpy-discussion, because lots of people who might be affected don't read PRs, so you should send a note there explaining the issue.

@khaeru
Copy link
Author
khaeru commented Jul 13, 2012

OK, will do.

@khaeru
Copy link
Author
khaeru commented Jul 15, 2012

@travisbot
Copy link

This pull request passes (merged 74e071e into 143fb18).

if names is True and comments in first_line:
if skip_header == -1:
first_line = first_line.split(comments)[0]
else:
first_line = asbytes('').join(first_line.split(comments)[1:])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI -- .split takes a second optional argument. All of these should just become first_line.split(comments, 1), and the join parts can just go away.

@charris
Copy link
Member
charris commented Apr 3, 2013

Ping the travisbot.

@charris charris closed this Apr 3, 2013
@charris charris reopened this Apr 3, 2013
@charris
Copy link
Member
charris commented Apr 3, 2013

I think this needs a test.

@njsmith As you noted, this seems to change behavior. I don't recall the discussion about that or if anything was decided.

@njsmith
Copy link
Member
njsmith commented Apr 3, 2013

A quick skim of that mailing list thread suggests that this change would break several people's code. I didn't read enough to see if a more generally acceptable solution was found.

@charris
Copy link
Member
AA4A charris commented Apr 4, 2013

Sounds to me like it should be closed then. I don't know why travisbot it trying to install this in 2.4, but I've seen that in a few other spots.

@charris
Copy link
Member
charris commented May 11, 2013

Going to close this.

@charris charris closed this May 11, 2013
luyahan pushed a commit to plctlab/numpy that referenced this pull request Apr 25, 2024
feat: Add vtst[q|d]_[s64|u64]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0