pandas.Timestamp.replace

pandas 3.1.1 · Arrays, scalars, and data types · method

Return a timestamp with selected fields such as year or hour updated.

Call syntax

Timestamp.replace(…) Full signature
Timestamp.replace(
    year=None,
    month=None,
    day=None,
    hour=None,
    minute=None,
    second=None,
    microsecond=None,
    nanosecond=None,
    tzinfo=<class 'object'>,
    fold=None,
)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
year Optional
Positional or keyword
Default None
int

Provide the calendar or period year.

month Optional
Positional or keyword
Default None
int

Provide the calendar month.

day Optional
Positional or keyword
Default None
int

Provide the day of the month or documented day field.

hour Optional
Positional or keyword
Default None
int

Provide the hour of the day.

minute Optional
Positional or keyword
Default None
int

Provide the minute of the hour.

second Optional
Positional or keyword
Default None
int

Provide the second of the minute.

microsecond Optional
Positional or keyword
Default None
int
nanosecond Optional
Positional or keyword
Default None
int
tzinfo Optional
Positional or keyword
Default <class 'object'>
tz-convertible
fold Optional
Positional or keyword
Default None
int

Returns

Timestamp