Skip to content

BUG: Inconsistent date resolution #61267

@super-ibby

Description

@super-ibby

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import datetime
import pandas as pd
pd.__version__  # ‘2.2.2’

d = datetime.datetime(2025, 4, 10)

pd.Series([d]).dtype  # dtype('<M8[ns]')

pd.DataFrame([{'date': d}])['date'].dtype  # dtype('<M8[ns]')

df = pd.DataFrame([{'x': 0}])
df['date'] = d  # <— broadcast scalar
df['date'].dtype  # dtype('<M8[us]')  <— different date resolution!

Issue Description

Date resolution differs between Series/DataFrame construction versus assignment via a scalar broadcast.

Expected Behavior

I’d expect the same date resolution across the examples I provided.

Installed Versions

commit : d9cdd2e
python : 3.11.9.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : AMD64
processor : Intel64 Family 6 Model 85 Stepping 7, GenuineIntel
byteorder : little

pandas : 2.2.2
numpy : 1.26.4
Cython : 3.0.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions