Timeutils - 時間系の変換ユーティリティ

pandas.Timestamp オブジェクトや pandas.Timedelta オブジェクト、 Unix タイムスタンプ、時刻を表す文字列の相互変換用メソッドを提供します。

micro2timedelta(micro)[ソース]

マイクロ秒を pandas.Timedelta オブジェクトに変換します。

パラメータ

micro (int) -- 変換元の時間(マイクロ秒単位)

戻り値

変換後の pandas.Timedelta オブジェクト

戻り値の型

pandas.Timedelta

str2timestamp(s)[ソース]

%Y-%m-%dT%H:%M:%S.%fZ 形式の文字列を pandas.Timestamp オブジェクトに変換します。

パラメータ

s (str) -- 変換元の文字列

戻り値

変換後の pandas.Timestamp オブジェクト

戻り値の型

pandas.Timestamp

timedelta2micro(td)[ソース]

pandas.Timedelta オブジェクトをマイクロ秒に変換します。

パラメータ

td (pandas.Timedelta) -- pandas.Timedelta オブジェクト

戻り値

変換後の時間(マイクロ秒単位)

戻り値の型

int

timestamp2str(ts)[ソース]

pandas.Timestamp オブジェクトを %Y-%m-%dT%H:%M:%S.%fZ 形式の文字列に変換します。

パラメータ

ts (pandas.Timestamp) -- 変換元の pandas.Timestamp オブジェクト

戻り値

変換後の文字列

戻り値の型

str

timestamp2unix(ts)[ソース]

pandas.Timestampオブジェクトを (秒,ナノ秒) 形式の Unix タイムスタンプへ変換します。

パラメータ

ts (pandas.Timestamp) -- 変換元の pandas.Timestamp オブジェクト

戻り値

(秒,ナノ秒) 形式の Unix タイムスタンプ

戻り値の型

(int, int)

timestamp2unixmicro(ts)[ソース]

pandas.Timestampオブジェクトをマイクロ秒単位の Unix タイムスタンプへ変換します。

パラメータ

ts (pandas.Timestamp) -- 変換元の pandas.Timestamp オブジェクト

戻り値

マイクロ秒単位の Unix タイムスタンプ

戻り値の型

int

unix2timestamp(unix_sec, unix_nano, tz=<UTC>)[ソース]

Unix タイムスタンプを pandas.Timestamp オブジェクトに変換します。

パラメータ
  • unix_sec (int) -- 変換元 Unix タイムスタンプの秒部分

  • unix_nano (int) -- 変換元 Unix タイムスタンプのナノ秒部分

  • tz (pytz.timezone) -- タイムゾーン

戻り値

変換後の pandas.Timestamp オブジェクト

戻り値の型

pandas.Timestamp