Num day to Name day with Pandas

后端 未结 4 2007
忘了有多久
忘了有多久 2021-02-13 21:47

If I use this funtion pd.DatetimeIndex(dfTrain[\'datetime\']).weekday I get number of the day, but I don\'t find any function which give the name of de day... So I

4条回答
  •  时光说笑
    2021-02-13 21:56

    Using dt.weekday_name is deprecated since pandas 0.23.0, instead, use dt.day_name():

    df.datetime.dt.day_name()
    
    0    Saturday
    1    Saturday
    2    Saturday
    3    Saturday
    4    Saturday
    5    Saturday
    6    Saturday
    7    Saturday
    8    Saturday
    9    Saturday
    Name: datetime, dtype: object
    

提交回复
热议问题