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

DataFrame.from_records doesn't get dtype from empty ndarray #3682

burdanov opened this issue May 22, 2013 · 0 comments · Fixed by #3708


Copy link

commented May 22, 2013

a = np.array([(1, 2)], dtype=[('id', np.int64), ('value', np.int64)])
df = pd.DataFrame.from_records(a, index='id') # ok

b = np.array([], dtype=[('id', np.int64), ('value', np.int64)])
df = pd.DataFrame.from_records(b, index='id') # KeyError: 'id'

The cause is _to_arrays checks for empty data before understanding that ndarray was passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.