API: creating DataFrame with no columns: object vs string dtype columns? #60338
Labels
API Design
Index
Related to the Index class or subclasses
Strings
String extension data type and string data
Milestone
A typical case we encounter in the tests is starting from an empty DataFrame, and then adding some columns.
Simplied example of this pattern:
The dataframe starts with an empty
Index
columns, and the default dtype for an empty Index isobject
dtype. And then inserting string labels for the actual columns into that Index object, preserves theobject
dtype.As long as we used object dtype for string column names, this was perfectly fine. But now that we will infer
str
dtype for actual string column names, it gets a bit annoying that the pattern above does not result instr
butobject
colums.This is not the best pattern, so maybe it's OK this does not give the ideal result. But at the same since we even use it quite regularly in our own tests, I suppose this is not that uncommon.
The text was updated successfully, but these errors were encountered: