Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
DataFrame.from_records doesn't get dtype from empty ndarray #3682
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.