Skip to content
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

ERR: Poor error message passing iterator to DataFrame constructor. #5357

Closed
jtratner opened this issue Oct 28, 2013 · 3 comments
Closed

ERR: Poor error message passing iterator to DataFrame constructor. #5357

jtratner opened this issue Oct 28, 2013 · 3 comments
Labels
Error Reporting Incorrect or improved errors from pandas
Milestone

Comments

@jtratner
Copy link
Contributor

E.g.:

from itertools import izip
df = DataFrame(izip(range(3), range(-3, 1), list('abc')), columns=list('abc'))
---------------------------------------------------------------------------
PandasError                               Traceback (most recent call last)
<ipython-input-3-15234514160e> in <module>()
      1 from itertools import izip
      2
----> 3 df = DataFrame(izip(range(3), range(-3, 1), list('abc')), columns=list('abc'))

../pandas/core/frame.pyc in __init__(self, data, index, columns, dtype, copy)
    270                                          copy=False)
    271             else:
--> 272                 raise PandasError('DataFrame constructor not properly called!')
    273
    274         NDFrame.__init__(self, mgr, fastpath=True)

PandasError: DataFrame constructor not properly called!
@jreback
Copy link
Contributor

jreback commented Oct 28, 2013

a list of iterators is ok (and tested already)

DataFrame([ range(10), range(10) ])

@jtratner
Copy link
Contributor Author

I understand, just saying we should consider improving the error message...

@jtratner
Copy link
Contributor Author

Once you hit that else clause, you aren't going to get back what you want anyways, so we may as well give a better error message (like "Hey, you can't pass an iterator here" or something like that).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas
Projects
None yet
Development

No branches or pull requests

2 participants