Python time_series_analysis

博客分类: research 阅读次数: comments

Python time_series_analysis

Pandas日期数据处理:如何按日期筛选、显示及统计数据

Time series analysis with pandas

Time series analysis with pandas. Part 2

利用python进行数据分析-时间序列3

Pandas中时间和日期处理

Pandas—时间索引

用 python 对人们使用自行车情况分析与预测

Introduction-to-Time-Series-Analysis-with-Pandas PDF

工作日

Count Workdays vs Weekends usage in pandas

How to group time series data by Monday, Tuesday .. ? pandas

Business days in Python with two pakage business_calendar and timeboard

Python-获取法定节假日

pandas-resample-documentation

B business day frequency C custom business day frequency (experimental) D calendar day frequency W weekly frequency M month end frequency SM semi-month end frequency (15th and end of month) BM business month end frequency CBM custom business month end frequency MS month start frequency SMS semi-month start frequency (1st and 15th) BMS business month start frequency CBMS custom business month start frequency Q quarter end frequency BQ business quarter endfrequency QS quarter start frequency BQS business quarter start frequency A year end frequency BA business year end frequency AS year start frequency BAS business year start frequency BH business hour frequency H hourly frequency T minutely frequency S secondly frequency L milliseonds U microseconds N nanoseconds

resample-interpolate-time-series-data-python

python 日期变量 判断节假日


from datetime import datetime
import pandas as pd

startdate = '2016-01-01'
enddate = '2016-12-31'
holiday = ['01-01', '05-01']

datalist = list(pd.date_range(start=startdate, end=enddate))
df = pd.DataFrame({'date':datalist})

df['month'] = df['date'].apply(lambda x: x.month) 
df['day'] = df['date'].apply(lambda x: x.day) 
df['weekday'] = df['date'].apply(lambda x: x.weekday()+1)

#工作日与休息日
isrest = ((df['weekday'] == 6) | (df['weekday'] == 7))  
df['label'] = isrest*1
#节假日
for h in holiday:
    #h = '01-01'
    h_month,h_day = h.split('-')
    h_index = ((df['month'] == int(h_month)) & (df['day'] == int(h_day)))
    df.loc[h_index, 'label'] = 2

np.is_busday() Custom Weekmasks

Custom Frequency Ranges & Custom Business Days & Business Hour

Convert dataframe date row to a weekend / not weekend value

df['WEEKDAY'] = ((pd.DatetimeIndex(df.index).dayofweek) // 5 == 1).astype(float)

Pandas-office-10分钟开始

绘图

pandas-seaborn-a-guide-to-handle-visualize-data-elegantly