Skip to content

Series / DataFrame constructors inconsistent with data=None and dtype #24385

@TomAugspurger

Description

@TomAugspurger

The series constructed below should (I think) be a special case of the DataFrame example, but they differ.

In [4]: pd.DataFrame(None, index=[1, 2, 3], columns=['a'], dtype=int)
Out[4]:
    a
1 NaN
2 NaN
3 NaN

In [5]: pd.Series(None, index=[1, 2, 3], dtype=int)
Out[5]:
1    0
2    0
3    0
dtype: int64

I don't know which makes more sense.

Metadata

Metadata

Assignees

Labels

ConstructorsSeries/DataFrame/Index/pd.array ConstructorsDtype ConversionsUnexpected or buggy dtype conversionsEnhancementError ReportingIncorrect or improved errors from pandas

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions