可以用pg自带函数select extract(dow from current_date),之所以没用主要是展示一下通过数学方法计算日期的原理. drop function if exists getDateWeek(date);drop function if exists intervalDay(date);drop function if exists getMonMaxDay(integer,integer);drop function if exists getMonMaxDate(
有时候我们的数据是按某个频率收集的,比如每日.每月.每15分钟,那么我们怎么产生对应频率的索引呢?pandas中的date_range可用于生成指定长度的DatetimeIndex.我们先看一下怎么生成日期范围:pd.date_range(startdate,enddate)1.生成指定开始日期和结束日期的时间范围: In:import pandas as pd index = pd.date_range('4/1/2019','5/1/2019') print(index)Out:Dateti