3番目のオブジェクトがタイムスタンプオブジェクトの下にあるのはなぜですか?私はTimeオブジェクトを期待していました。ここでpandas.Timestampをサブクラス化する方法?
import pandas as pd
from datetime import datetime
class Time(pd.Timestamp):
def __new__(cls, *args, **kwargs):
return pd.Timestamp.__new__(cls, *args, **kwargs)
print type(Time(datetime(2012, 5, 1)))
print type(Time('2012-05-01'))
print type(Time(2012, 5, 1))
は私のpython 2.7.11とパンダ0.19.0から見た結果は以下のとおりです。
<class '__main__.Time'>
<class '__main__.Time'>
<class 'pandas.tslib.Timestamp'>