Converting pandas.tslib.Timestamp to datetime python

后端 未结 9 1139
予麋鹿
予麋鹿 2020-12-05 17:36

I have a df time series. I extracted the indexes and want to convert them each to datetime. How do you go about doing that? I tried to use pa

9条回答
  •  攒了一身酷
    2020-12-05 17:57

    This works for me, to create date for insert in MySQL, please try:

    pandas_tslib = pandas_tslib.to_pydatetime()
    pandas_tslib = "'" + pandas_tslib.strftime('%Y-%m-%d') + "'"
    

提交回复
热议问题