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

Closed
burdanov opened this Issue May 22, 2013 · 0 comments

Comments

Projects
None yet
1 participant
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.

jreback closed this in #3708 May 30, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment