Can Pandas plot a histogram of dates?

前端 未结 8 1479
我在风中等你
我在风中等你 2020-11-28 03:15

I\'ve taken my Series and coerced it to a datetime column of dtype=datetime64[ns] (though only need day resolution...not sure how to change).

i         


        
8条回答
  •  孤街浪徒
    2020-11-28 04:16

    I think for solving that problem, you can use this code, it converts date type to int types:

    df['date'] = df['date'].astype(int)
    df['date'] = pd.to_datetime(df['date'], unit='s')
    

    for getting date only, you can add this code:

    pd.DatetimeIndex(df.date).normalize()
    df['date'] = pd.DatetimeIndex(df.date).normalize()
    

提交回复
热议问题