程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

The use of pandas advanced interface DT in Python data analysis library

編輯:Python

Series Objects and DataFrame The column data of provides cat、dt、str Three attribute interfaces (accessors), Corresponding to classification data respectively 、 Date time data and string data , Through these interfaces, specific functions can be realized quickly , It is fast . Read today pandas The official documents summarize the following commonly used api.
**

1.dt.date and dt.normalize(), They all return a date Date part , That is, only the date of . But the difference is date Back to Series yes object Type of ,normalize() Back to Series yes datetime64 Type of . Here is a simple creation dataframe.

**



*

2.dt.year、dt.month、dt.day、dt.hour、dt.minute、dt.second、dt.week (dt.weekofyear and dt.week equally ) Return the year of the date respectively 、 month 、 Japan 、 Hours 、 branch 、 Seconds and the week of the year

*

3.dt.weekday(dt.dayofweek equally ) Returns the day of the week ,0 On behalf of Monday ,6 For Sunday ,dt.weekday_name Return to the English of the day of the week .


4.dt.dayofyear Return to the day of the year ,dt.quarter Get what quarter each date is .

5.dt.is_month_start and dt.is_month_end Determine whether the date is the first or last day of each month , Can be month Switch to year and quarter Whether the corresponding judgment date is the first or last day of each year or quarter .

6.dt.is_leap_year Determine if it's a leap year

7.dt.month_name() Return the English name of the month .


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved