Haven't found any way to mutate an existing pandas.Timestamp
myself, but also have not found any documentation explicitly stating it to be immutable.
Anyone knows the answer or has a way to find out?
Haven't found any way to mutate an existing pandas.Timestamp
myself, but also have not found any documentation explicitly stating it to be immutable.
Anyone knows the answer or has a way to find out?
After looking to the source code, I found out the inherit from datetime.datetime
which is immutable.
# in pandas/_lib/tslibs/timestamp.pyx
cdef class _Timestamp(datetime):
# ...
class Timestamp(_Timestamp): # This is the class that is exported
If you look inside the python implementation of datetime
you see that it is supposed to be immutable (via onway properties):
# Read-only field accessors
@property
def year(self):
"""year (1-9999)"""
return self._year
@property
def month(self):
"""month (1-12)"""
return self._month
@property
def day(self):
"""day (1-31)"""
return self._day
@property
def hour(self):
"""hour (0-23)"""
return self._hour
@property
def minute(self):
"""minute (0-59)"""
return self._minute
@property
def second(self):
"""second (0-59)"""
return self._second
@property
def microsecond(self):
"""microsecond (0-999999)"""
return self._microsecond