-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
API DesignConstructorsSeries/DataFrame/Index/pd.array ConstructorsSeries/DataFrame/Index/pd.array ConstructorsDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversions
Milestone
Description
Currently an empty Series
has a float dtype:
In [15]: pd.Series().dtype
Out[15]: dtype('float64')
This is consistent with NumPy, but inconsistent with the rest of pandas:
In [18]: pd.Index([]).dtype
Out[18]: dtype('O')
In [19]: pd.DataFrame(columns=['A']).dtypes
Out[19]:
A object
dtype: object
I think it's best to just make all our containers treat empty as object dtype, unless explicitly told otherwise (excluding specialized containers like Int64Index
).
jorisvandenbossche
Metadata
Metadata
Assignees
Labels
API DesignConstructorsSeries/DataFrame/Index/pd.array ConstructorsSeries/DataFrame/Index/pd.array ConstructorsDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversions