8000 "Importing data with genfromtxt" doc page · Issue #7662 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
8000

"Importing data with genfromtxt" doc page #7662

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
victoriastuart opened this issue May 23, 2016 · 4 comments
Closed

"Importing data with genfromtxt" doc page #7662

victoriastuart opened this issue May 23, 2016 · 4 comments

Comments

@victoriastuart
Copy link

Re:

https://docs.scipy.org/doc/numpy-dev/user/basics.io.genfromtxt.html

... great job/effort; your examples are also fabulous: clever, illustrative, powerful! :-)

There is a Python 2 vs. 3 issue: see my 'answer'/comments, here:

https://stackoverflow.com/questions/11914472/stringio-in-python3/37380717#37380717

Also, in your last example, I believe you should have

np.genfromtxt(StringIO(data), **kwargs)

not

np.genfromtxt(StringIO.StringIO(data), **kwargs)

Also, it would be really great to have those doc pages as a Jupyter notebook(s), or at least have the code given in raw form, minus the prompts (>>> ). ;-)

Those comments often wrap into the code, which is necessarily distracting; you could also break those into two or more lines (to the right), as needed: e.g.

some code      # This is just
               # a small comment.

vs.

some code      # This is just
a small comment.
more code
...

or adjust your page formatting (CSS? page / code block width and/or font size?).

Minor points; again, fabulous work; much appreciated! :-D

@rgommers
Copy link
Member

Also, it would be really great to have those doc pages as a Jupyter notebook(s), or at least have the code given in raw form, minus the prompts (>>> ). ;-)

Did you notice the >>> at the right top of every example block? Clicking that removes the promts and the output, so only the code remains and you can copy-paste it easily.

Notebooks probably aren't going to happen, that's quite a bit of work and there'll be a huge amount of them (not even sure where we'd put them).

@rgommers
Copy link
Member
rgommers commented May 23, 2016

Also, in your last example, I believe you should have
np.genfromtxt(StringIO(data), **kwargs)

good catch, thanks. Actually, we should replace the first import as well, from io import StringIO

@victoriastuart
Copy link
Author

"Did you notice the >>> at the right top of every example block?" >> whoops! Thx :-)

@rgommers
Copy link
Member

Thanks for filing this issue, needs fixing indeed. It's even worse, somehow we managed to break the Python 2.7 code as well with numpy 1.11.0:

In [1]: from io import StringIO, BytesIO

In [2]: data = "1, 2, 3\n4, 5, 6"

In [3]: np.genfromtxt(StringIO(data), delimiter=",")
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-b21e8ad6019c> in <module>()
----> 1 np.genfromtxt(StringIO(data), delimiter=",")

TypeError: initial_value must be unicode or None, not str

@charris charris closed this as completed in e928bd9 Jun 3, 2016
charris added a commit that referenced this issue Jun 3, 2016
DOC: fix broken genfromtxt examples in user guide.  Closes gh-7662.
< 48F3 /span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0