[英]Is pandas.timestamp python datetime?
I was working on time submodule of astropy. 我正在研究astropy的时间子模块。 It can parse python
datetime
objects. 它可以解析python
datetime
对象。
When I pass a pandas.Timestamp
object astropy.time.Time thinks it's a datetime
object. 当我传递
pandas.Timestamp
对象astropy.time.Time认为它是一个datetime
对象时。
Tracking down the issue, I found this. 找出问题所在,发现了这一点。
>>> t = pandas.Timestamp('2018-01-01')
>>> isinstance(t, datetime.datetime)
True
My question is, why is isinstance
returning True
? 我的问题是,为什么
isinstance
返回True
?
because it inherits from datetime.datetime 因为它继承自datetime.datetime
class _Timestamp(__datetime.datetime):
so it is an instance of a datetime.datetime
... 所以它是
datetime.datetime
一个实例...
TimeStamp is the pandas equivalent of python's Datetime and is interchangable with it in most cases.
TimeStamp与python的Datetime等效,在大多数情况下可以互换。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.