Skip to content

BUG/TST: Allow generators in DataFrame.from_records #4911

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

Merged
merged 1 commit into from
Oct 4, 2013
Merged

BUG/TST: Allow generators in DataFrame.from_records #4911

merged 1 commit into from
Oct 4, 2013

Conversation

tinproject
Copy link
Contributor

closes #4910

  • nrows implementation doesn't allow unknown size iterator like
    generators, if nrows = none ends with a TypeError.
  • To allow generators if nrows=None consume it into a list.
  • Add two tests of generators input.

@jreback
Copy link
Contributor

jreback commented Sep 21, 2013

pls add release notes (doc/source/release.rst), referencing the issue
pls hook up travis (see contributing.md)

thanks!

@tinproject
Copy link
Contributor Author

Sorry for the mess, I'm new to github.
I've tested it locally with python 2.7 and 3.3 but didn't work with 2.6. Now it's all ok.

@jtratner
Copy link
Contributor

I recognize that this may be silly, but how is this supposed to work if you passed something like this:

gen = ('a' for _ in range(50))
DataFrame.from_records(gen)

Just wondering if this needs to be caught anywhere or if this is okay

@tinproject
Copy link
Contributor Author

I suppouse it's ok, the patch only put the generator in a list in the same fashion as main constructor.
DataFrame.from_records() expects a collection of records, which every record it's a collection of fields: list, tuple, dict, or in your case a string wich it's a sequence (collection) of characters (only one character in your example).

@jtratner
Copy link
Contributor

it's fine, it looks like it just works the same as a list. Doesn't need to be added as a test case either.

@jreback
Copy link
Contributor

jreback commented Sep 26, 2013

@tinproject can you rebase and squash to commit? otherwise looks ok

@tinproject
Copy link
Contributor Author

Hope it's ok, if it's not please give me a git command example, as i said i'm new to git :(

@jreback
Copy link
Contributor

jreback commented Sep 26, 2013

pretty good instructions here: https://github.com/pydata/pandas/wiki/Using-Git, let us know

@tinproject
Copy link
Contributor Author

I think it's now ok. Release notes file release.rst conflicts but are trivial and I thought I solved it.

@jreback
Copy link
Contributor

jreback commented Oct 2, 2013

try git rebase -i upstream/master need to remove that merge of master commit

- nrows implementation doesn't allow unknown size iterator like
generators, if nrows = none ends with a TypeError.
- To allow generators if nrows=None consume it into a list.
- Add two tests of generators input.
- Add release notes for #4910
@tinproject
Copy link
Contributor Author

@jreback now it's all ok, no? I must improve on git, sorry.

@jreback
Copy link
Contributor

jreback commented Oct 3, 2013

yes...looks good.....let me review

@jreback
Copy link
Contributor

jreback commented Oct 3, 2013

git just comes from practice! submit more PR's!

@jreback jreback merged commit 3efb86e into pandas-dev:master Oct 4, 2013
@jreback
Copy link
Contributor

jreback commented Oct 4, 2013

@tinproject thank you!

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.

BUG/TST: Allow generators in DataFrame.from_records
3 participants