-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
MAINT (API?): organize npyio.recfromcsv defaults #3830
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
Conversation
You might want to add a test to
The existing tests all use |
@@ -1867,16 +1867,18 @@ def recfromcsv(fname, **kwargs): | |||
numpy.genfromtxt : generic function to load ASCII data. | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add:
Notes
-----
By default, dtype
is None, which means that the data-type of the output
array will be determined from the data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi.
I think we should consider the state of the io documentation as a whole. The four functions ndfromtxt
,
mafromtxt
, recfromtxt
and recfromcsv
exist online only as remarks in the user guide : http://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html . They are not mentioned in http://docs.scipy.org/doc/numpy/reference/routines.io.html and therefore have no sphinx docs in the reference. Of-course they do appear in the python help() system.
Not only dtype
is given a default, but also case_sensitive
, names
and delimiter
,
so they should be addressed together. Any ideas on how to do that?
Thanks,
Yaron
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like it would be a good idea to add them. The appropriate spot looks to be doc/source/reference/routines.io.rst
. You can open a new PR for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'll open another PR for that.
Travis error looks bogus, restarted tests. |
LGTM. Can you add a note to |
case_sensitive=case_sensitive) | ||
usemask = kwargs.get("usemask", False) | ||
# Set default kwargs as relevant to csv import. | ||
# These seem to be undocumented. (case_sensitive is mentioned in basics.io) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are all keywords in genfromtxt
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should mention that these are keywords used by genfromtxt
.
Needs a rebase. |
Organizes the default kwargs in recfromcsv. Changes two undocumented kwargs behaviors: * previously, if a user set `names=None`, it was ignored and replaced with `names=True` * the `dtype` kwarg was ignored. If `update` was given, it was used as `dtype`, and if not, None was used. We can retain the `update` behavior by using `kwargs.setdefault("dtype",kwargs.get('update', None))`. This Closes numpy#311 .
It needed a rebase because of the release notes. I've rebased. |
Hi @charris, any news? |
# Set default kwargs as relevant to csv import. | ||
# These seem to be undocumented. (case_sensitive is mentioned in basics.io) | ||
kwargs.setdefault("case_sensitive", "lower") | ||
# previously, names were set to True if they were not set or if they |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two comment lines can be removed.
LGTM modulo a few nitpicks. |
Removed two irrelevant comments about code history. P.S. my first try with Github's online editor.
The travis error is about fetching from sphinx or something. Anyway, the only changes in the commit are in comments. |
Hi @charris or any other dev, could you please try to rebuild the travis run? |
MAINT (API?): organize npyio.recfromcsv defaults
Thanks @jarondl. |
Organizes the default kwargs in recfromcsv. Changes two undocumented
kwargs behaviors:
names=None
, it was ignored and replacedwith
names=True
dtype
kwarg was ignored. Ifupdate
was given, it was used asdtype
, and if not, None was used. We can retain theupdate
behaviorby using
kwargs.setdefault("dtype",kwargs.get('update', None))
.This Closes npyio.py --> recfromcsv seems to have a bug that ignores any dtypes provided #311 .