python pandas extract unique dates from time series

前端 未结 3 1367
温柔的废话
温柔的废话 2021-02-01 18:27

I have a DataFrame which contains a lot of intraday data, the DataFrame has several days of data, dates are not continuous.

 2012-10-08 07:12:22            0.0          


        
3条回答
  •  花落未央
    2021-02-01 19:06

    Using regex:

    (\d{4}-\d{2}-\d{2})
    

    Run it with re.findall function to get all matches:

    result = re.findall(r"(\d{4}-\d{2}-\d{2})", subject)
    

提交回复
热议问题