LoginSignup
1
0

More than 1 year has passed since last update.

np.datetime64の使い方

Posted at

内容

numpyのdatetime64が使いにくいので、ググってもあまりわからなかったので正解ではないかもしれないけど動いたので紹介

環境

 python 3.7.15 numpy 1.16.5 または
 python 3.10.8 numpy 1.23.4

datetime64からdatetimeへの変換

test.py
  t1 = np.datetime64('2023-01-15T13:11:11')
  #datetimeに変換
  t2 = t1.item()
  #t2だったらいろいろできる
  t2.strftime('%Y/%M/%D %T')
  t2.year
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0