Skip to content

DataFrame.from_records incorrectly up-converts dtypes to object. #2623

Closed
@dalejung

Description

@dalejung
rows = []
rows.append([pd.datetime(2010, 1, 1), 1])
rows.append([pd.datetime(2010, 1, 2), 'hi']) # test col upconverts to obj

df2_obj = pd.DataFrame.from_records(rows, columns=['date', 'test'])

print df2_obj.date.dtype # object

If the 'hi' is changed to an int then df2_obj.date.dtype is equal to M8[ns]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions