代码之家  ›  专栏  ›  技术社区  ›  MathMan 99

Python:生成每周时间戳

  •  0
  • MathMan 99  · 技术社区  · 4 年前

    如何在Python中生成每周时间戳?

    2021-01-07 12:00:00
    2021-01-14 12:00:00
    2021-01-21 12:00:00
    etc...
    

    我还想将这些转换为UNIX时间戳。

    有没有办法一步到位?

    非常感谢。

    1 回复  |  直到 4 年前
        1
  •  2
  •   Learning is a mess    4 年前

    检查 https://pandas.pydata.org/docs/reference/api/pandas.date_range.html

    pd.date_range('2021-01-07 12:00:00', '2021-01-21 12:00:00', freq='7D')