【问题标题】:Looping through pandas series to return date in minutes循环遍历 pandas 系列以在几分钟内返回日期
【发布时间】:2017-12-08 22:09:48
【问题描述】:

我有一个熊猫系列,看起来像:

505     00:12:00
325     00:10:00
2929    00:09:00
261     00:08:00

我想以 [12,10,09,08] 形式的数组返回日期。我该怎么做呢?

【问题讨论】:

    标签: pandas series


    【解决方案1】:

    试试

    l = pd.to_datetime(df.time, format = '%H:%M:%S').dt.minute.tolist()
    
    [12, 10, 9, 8]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-17
      • 1970-01-01
      • 1970-01-01
      • 2021-03-06
      相关资源
      最近更新 更多