-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
Can't create DataFrame from SQLite3 cursor #10134
Comments
what is |
|
It's not a big issue: passing cursor to list constructor results normal list wich is accepted by DataFrame.
|
type checking in python is fine. In pandas is actually quite a bit more complicated, because we need to determine, if, for example a list of-lists or list-of scalars are passed, then this is problematic so an |
I just create a generator with not defined length. And DataFrame accepts it as I expect.
|
a generator is fine. you have an |
Hmmm. I'll see how to overcome it. |
@jreback Out of curiosity, why is a generator fine, but not an iterator? It looks like DataFrame's constructor checks to see if the data argument is a GeneratorType and then wraps it ( |
see my comment above this is an old issue - so don't really remember |
Generator is also not required to have a len. The solution for generators in the DataFrame constructor is to consume it into a list() and from there treat it as though a list was passed as the data arg. The same should work for iters. If you're worried about infinite iterators, then you should be equally worried about infinite generators, unless I'm misunderstanding something. I'll take a look at the tests. |
Duplicate of #2193 I also think it'll be possible to turn the iterable into a list, just like with a generator. |
When I pass cursor as data to DataFrame constructor an error occurs.
But normal generators is accepted
It feels like inconsistence.
The text was updated successfully, but these errors were encountered: