teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

修正

2020/10/27 05:10

投稿

jeanbiego
jeanbiego

スコア3966

answer CHANGED
@@ -12,9 +12,9 @@
12
12
  df = pd.read_csv(io.StringIO(data))
13
13
  # ここまでテスト用データ
14
14
 
15
- def zfill_10(t):
15
+ def zfill_12(t):
16
16
  return str(t).zfill(12)
17
- df["time"] = df["time"].apply(zfill_10) # 時をゼロ埋め
17
+ df["time"] = df["time"].apply(zfill_12) # 時をゼロ埋め
18
18
  df["time"] = pd.to_datetime(df["time"], format="%H%M%S%f") # 文字列→時刻
19
19
  print(df)
20
20
  # id time