1.时间戳Timestamp()

参数可以为各种形式的时间,Timestamp()会将其转换为时间。

time1 = pd.Timestamp('2019/7/13')
time2 = pd.Timestamp('13/7/2019 13:05')
time3 - pd.Timestamp('2019-7-13')
time4 = pd.Timestamp('2019 7 13 13:05')
time5 = pd.Timestamp('2019 July 13 13')
time6 = pd.Timestamp(datetime.datetime(2019,7,13,13,5))
print(datetime.datetime.now(),type(datetime.datetime.now()))
print(time1,type(time1))
print(time2)
print(time3)
print(time4)
print(time5)
print(time6)
# 2019-07-25 14:33:20.482696 <class 'datetime.datetime'>
# 2019-07-13 00:00:00 <class 'pandas._libs.tslibs.timestamps.Timestamp'>
# 2019-07-13 13:05:00
# 2019-07-13 00:00:00
# 2019-07-13 13:05:00
# 2019-07-13 13:00:00
# 2019-07-13 13:05:00

Timestamp()

2.to_datetime()时间戳和时间序列

对于单个时间的转换,与timestamp()的用法相同,将各种形式的时间参数转换为时间。

time1 = pd.to_datetime('2019/7/13')
time2 = pd.to_datetime('13/7/2019 13:05')
time3 = pd.to_datetime(datetime.datetime(2019,7,13,13,5))
print(datetime.datetime.now(),type(datetime.datetime.now()))
print(time1,type(time1))
print(time2)
print(time3)
# 2019-07-23 22:33:56.650290 <class 'datetime.datetime'>
# 2019-07-13 00:00:00 <class 'pandas._libs.tslibs.timestamps.Timestamp'>
# 2019-07-13 13:05:00
# 2019-07-13 13:05:00

to_datetime()处理单个时间

对于多个时间的处理,Timestamp()无法使用,而to_datetime()可以处理成时间序列

timelist = ['2019/7/13','13/7/2019 13:05',datetime.datetime(2019,7,13,13,5)]
t = pd.to_datetime(timelist)
print(t)
print(type(t))
# DatetimeIndex(['2019-07-13 00:00:00', '2019-07-13 13:05:00','2019-07-13 13:05:00'],
# dtype='datetime64[ns]', freq=None)
# <class 'pandas.core.indexes.datetimes.DatetimeIndex'>

to_datetime()处理时间序列

3.DatetimeIndex时间序列

一个时间序列,可通过索引获取值。

t1 = pd.DatetimeIndex(['2019/7/13','13/7/2019 13:05',datetime.datetime(2019,7,13,18,5)])
print(t1,type(t1))
print(t1[1])
# DatetimeIndex(['2019-07-13 00:00:00', '2019-07-13 13:05:00',
# '2019-07-13 18:05:00'],
# dtype='datetime64[ns]', freq=None) <class 'pandas.core.indexes.datetimes.DatetimeIndex'>
# 2019-07-13 13:05:00

DatetimeIndex

4.TimeSeries

索引为DatetimeIndex的Series

v = ['a','b','c']
t = pd.DatetimeIndex(['2019/7/13','13/7/2019 13:05',datetime.datetime(2019,7,13,18,5)])
s = pd.Series(v,index = t,name='s')
print(s)
# 2019-07-13 00:00:00 a
# 2019-07-13 13:05:00 b
# 2019-07-13 18:05:00 c
# Name: s, dtype: object

TimeSeries

重置频率asfreq('新频率',method)

表示对原TimeSeris索引重新划分频率,重置索引后如果出现新的索引,method默认为None表示对应的值为NaN,ffill和bfill分别表示用前面、后面的值填充。

t = pd.date_range('2019/1/3','2019/1/5')
arr = pd.Series(np.arange(3),index=t)
print(arr)
print('----------------------------')
print(arr.asfreq('8H'))
print('----------------------------')
print(arr.asfreq('8H',method='bfill'))
# 2019-01-03 0
# 2019-01-04 1
# 2019-01-05 2
# Freq: D, dtype: int32
# ----------------------------
# 2019-01-03 00:00:00 0.0
# 2019-01-03 08:00:00 NaN
# 2019-01-03 16:00:00 NaN
# 2019-01-04 00:00:00 1.0
# 2019-01-04 08:00:00 NaN
# 2019-01-04 16:00:00 NaN
# 2019-01-05 00:00:00 2.0
# Freq: 8H, dtype: float64
# ----------------------------
# 2019-01-03 00:00:00 0
# 2019-01-03 08:00:00 1
# 2019-01-03 16:00:00 1
# 2019-01-04 00:00:00 1
# 2019-01-04 08:00:00 2
# 2019-01-04 16:00:00 2
# 2019-01-05 00:00:00 2
# Freq: 8H, dtype: int32

时间序列的asfreq()

移位shift(n,freq,fill_value)

如果只有参数n,表示索引不变而将值进行移动,正数表示向后移动,负数表示向前移动,移动后出现的空值用fill_value填充,默认为NaN。

如果指定了n和freq,表示将索引按照指定的freq进行加法或减法,而值不变。

t = pd.date_range('2019/1/3','2019/1/5')
arr = pd.Series([15,16,14],index=t)
print(arr)
print('-----------------------')
print(arr.shift(1,fill_value='haha'))#移动后第一个索引没有对应的值,以haha填充
print('-----------------------')
print(arr.shift(-1))#移动后最后一个索引没有对应的值,默认为NaN
# 2019-01-03 15
# 2019-01-04 16
# 2019-01-05 14
# Freq: D, dtype: int64
# -----------------------
# 2019-01-03 haha
# 2019-01-04 15
# 2019-01-05 16
# Freq: D, dtype: object
# -----------------------
# 2019-01-03 16.0
# 2019-01-04 14.0
# 2019-01-05 NaN
# Freq: D, dtype: float64

shift()移动值

t = pd.date_range('2019/1/3','2019/1/5')
arr = pd.Series([15,16,14],index=t)
print(arr)
print('-----------------------')
print(arr.shift(2,freq='D'))
print('-----------------------')
print(arr.shift(-2,freq='H'))
# 2019-01-03 15
# 2019-01-04 16
# 2019-01-05 14
# Freq: D, dtype: int64
# -----------------------
# 2019-01-05 15
# 2019-01-06 16
# 2019-01-07 14
# Freq: D, dtype: int64
# -----------------------
# 2019-01-02 22:00:00 15
# 2019-01-03 22:00:00 16
# 2019-01-04 22:00:00 14
# Freq: D, dtype: int64

shift()移动索引

5.date_range()和bdate_range()

生成时间范围,类型为DatetimeIndex,date_range()是生成自然日,bdate_range()是生成工作日,下面以date_range()为例。

使用方法:date_range(start,end,periods,freq,closed,normalize,name,tz)

start:时间起始点

end:时间结束点

periods:生成的时间个数

freq:频率,默认为D日历天,其他Y、M、B、H、T/MIN、S、L、U分别表示年、月、工作日、小时、分、秒、毫秒、微妙(不区分大小写)

  其他参数:W-MON表示从每周的周几开始,WOM-2MON表示每月的周几开始

closed:默认为None,表示包括起始点和结束点,left表示包括起始点,right表示包括终端

normalize:默认为false,True表示将时刻设置为0:00:00

name:时间范围的名称

tz:时区

t1 = pd.date_range('2000/1/5','2003/1/5',freq='y')
t2 = pd.date_range('2000/1/1','2000/3/5',freq='m')
t3 = pd.date_range('2000/1/1','2000/1/10',periods=3)
t4 = pd.date_range('2000/1/1 12','2000/1/1 15',freq='h')
t5 = pd.date_range('2000/1/1 12','2000/1/1 15',freq='h',closed='left',name='t3')
t6 = pd.date_range(start = '2000/1/1 11:00:00',periods=3)
t7 = pd.date_range(end = '2000/1/1 12:00:00',periods=3)
print(t1)
print(t2)
print(t3)
print(t4)
print(t5)
print(t6)
print(t7)
# DatetimeIndex(['2000-12-31', '2001-12-31', '2002-12-31'], dtype='datetime64[ns]', freq='A-DEC')
# DatetimeIndex(['2000-01-31', '2000-02-29'], dtype='datetime64[ns]', freq='M')
# DatetimeIndex(['2000-01-01 00:00:00', '2000-01-05 12:00:00', '2000-01-10 00:00:00'],
# dtype='datetime64[ns]', freq=None)
# DatetimeIndex(['2000-01-01 12:00:00', '2000-01-01 13:00:00', '2000-01-01 14:00:00', '2000-01-01 15:00:00'],
# dtype='datetime64[ns]', freq='H')
# DatetimeIndex(['2000-01-01 12:00:00', '2000-01-01 13:00:00', '2000-01-01 14:00:00'],
# dtype='datetime64[ns]', name='t3', freq='H')
# DatetimeIndex(['2000-01-01 11:00:00', '2000-01-02 11:00:00', '2000-01-03 11:00:00'],
# dtype='datetime64[ns]', freq='D')
# DatetimeIndex(['1999-12-30 12:00:00', '1999-12-31 12:00:00', '2000-01-01 12:00:00'],
# dtype='datetime64[ns]', freq='D')

date_range()

6.Period()时期

Period('date',freq = '*'):默认的频率freq为传入时间的最小单位,例如传入时间的形式最小月份,那么默认频率为月,如果传入时间的形式最小单位为分钟,那么默认频率为分。

下面例子中的p4,设置频率为2M即2个工作日,那么对于p4来说的1个单位就相当于2M,所以p4+3就是p4+3*2M

p1 = pd.Period('')
p2 = pd.Period('',freq = 'M')
print(p1,type(p1),p1+1)
print(p2,p2+1)
p3 = pd.Period('2017-1-1')
p4 = pd.Period('2017-1-1',freq = '2M')
print(p3,p3+2)
print(p4,p4+3)
p5 = pd.Period('2017-1-1 13:00')
p6 = pd.Period('2017-1-1 13:00',freq = '5T')
print(p5,p5+4)
print(p6,p6+5)
# 2017 <class 'pandas._libs.tslibs.period.Period'> 2018
# 2017-01 2017-02
# 2017-01-01 2017-01-03
# 2017-01 2017-07
# 2017-01-01 13:00 2017-01-01 13:04
# 2017-01-01 13:00 2017-01-01 13:25

Period()

7.period_range()

时期范围,类型为PeriodIndex,用法类似date_range()。

p = pd.period_range('2000/1/1','2000/1/2',freq='6H')
print(p,type(p))
# PeriodIndex(['2000-01-01 00:00', '2000-01-01 06:00', '2000-01-01 12:00','2000-01-01 18:00', '2000-01-02 00:00'],
# dtype='period[6H]', freq='6H') <class 'pandas.core.indexes.period.PeriodIndex'>

period_range()

period和period_range()的asfreq,默认显示freq中的最后一个值,如果指定how='start'则显示freq中的第一个值。

p1 = pd.Period( '2019/5/1')   #2019-05-01
p2 = p1.asfreq('H') #2019-05-01 23:00
p3 = p1.asfreq('2H',how='start') #2019-05-01 00:00,频率设置为2M的2并不起作用
p4 = p1.asfreq('S') #2019-05-01 23:59:59
p5 = p1.asfreq('S',how='start') #2019-05-01 00:00:00

Period()的asfreq

p = pd.period_range('2015/3','2015/6',freq='M')
ps1 = pd.Series(np.random.rand(len(p)),index=p.asfreq('D'))
ps2 = pd.Series(np.random.rand(len(p)),index=p.asfreq('D',how='start'))
print(p)
print(ps1)
print('--------------------------')
print(ps2)
# PeriodIndex(['2015-03', '2015-04', '2015-05', '2015-06'], dtype='period[M]', freq='M')
# 2015-03-31 0.708730
# 2015-04-30 0.238101
# 2015-05-31 0.793451
# 2015-06-30 0.584621
# Freq: D, dtype: float64
# --------------------------
# 2015-03-01 0.397659
# 2015-04-01 0.032417
# 2015-05-01 0.763550
# 2015-06-01 0.129498
# Freq: D, dtype: float64

period_range()的asfreq

8.to_timestamp()和to_period()

时间戳和时期的转化.

p1 = pd.date_range('2015/3','2015/6',freq='M')
p2 = pd.period_range('2015/3','2015/6',freq='M')
ps1 = pd.Series(np.random.rand(len(p1)),index=p1)
ps2 = pd.Series(np.random.rand(len(p2)),index=p2)
print(ps1)
print('---------------')
print(ps2)
print('---------------')
print(ps1.to_period())
print('---------------')
print(ps2.to_timestamp())
# 2015-03-31 0.066644
# 2015-04-30 0.159969
# 2015-05-31 0.111716
# Freq: M, dtype: float64
# ---------------
# 2015-03 0.966091
# 2015-04 0.779257
# 2015-05 0.953817
# 2015-06 0.765121
# Freq: M, dtype: float64
# ---------------
# 2015-03 0.066644
# 2015-04 0.159969
# 2015-05 0.111716
# Freq: M, dtype: float64
# ---------------
# 2015-03-01 0.966091
# 2015-04-01 0.779257
# 2015-05-01 0.953817
# 2015-06-01 0.765121
# Freq: MS, dtype: float64

to_timestamp()和to_period()

9.时间序列索引

可通过下标和标签进行索引,标签可以为各种形式的时间.

p = pd.Series(np.random.rand(4),pd.period_range('2015/3','2015/6',freq='M'))
print(p)
print(p[0])
print(p.iloc[1])
print(p.loc['2015/5'])
print(p.loc['2015-5'])
print(p.loc[''])
# 2015-03 0.846543
# 2015-04 0.631335
# 2015-05 0.218029
# 2015-06 0.646544
# Freq: M, dtype: float64
# 0.846543180730373
# 0.6313347971612441
# 0.21802886896115137
# 0.21802886896115137
# 0.21802886896115137

时间序列索引

p = pd.Series(np.random.rand(5),index=pd.period_range('2015/5/30','2015/6/3'))
print(p)
print(p[0:2]) #下标索引,末端不包含
print(p.iloc[0:2]) #下标索引,末端不包含
print(p.loc['2015/5/30':'2015/6/1']) #标签索引,两端包含
print(p['2015/5']) #只传入月份,会将序列中在此月份中的行全部显示
# 2015-05-30 0.976255
# 2015-05-31 0.671226
# 2015-06-01 0.888682
# 2015-06-02 0.875901
# 2015-06-03 0.953603
# Freq: D, dtype: float64
# 2015-05-30 0.976255
# 2015-05-31 0.671226
# Freq: D, dtype: float64
# 2015-05-30 0.976255
# 2015-05-31 0.671226
# Freq: D, dtype: float64
# 2015-05-30 0.976255
# 2015-05-31 0.671226
# 2015-06-01 0.888682
# Freq: D, dtype: float64
# 2015-05-30 0.976255
# 2015-05-31 0.671226
# Freq: D, dtype: float64

时间序列切片

10.唯一unique()

is_unique判断序列的值是否唯一,index.is_unique判断标签是否唯一。

对于时间序列的索引,如果时间序列不重复,取单个时间对应的值的结果为一个数值。

而如果时间序列有重复,取无重复时间的结果仍为序列,如果取有重复的时间的值,默认会将所有符合条件的结果显示出来,可使用groupby进行分组。

p = pd.Series(np.random.rand(5),index=pd.DatetimeIndex(['2019/5/1','2019/5/2','2019/5/3','2019/5/1','2019/5/2']))
print(p)
print(p.is_unique,p.index.is_unique)
print('--------------------')
print(p['2019/5/3'])
print('--------------------')
print(p['2019/5/1'])
print('--------------------')
print(p['2019/5/1'].groupby(level=0).mean())#对标签为2019/5/1按x轴分组,值取两者的平均值
# 2019-05-01 0.653468
# 2019-05-02 0.116834
# 2019-05-03 0.978432
# 2019-05-01 0.724633
# 2019-05-02 0.250191
# dtype: float64
# True False
# --------------------
# 2019-05-03 0.978432
# dtype: float64
# --------------------
# 2019-05-01 0.653468
# 2019-05-01 0.724633
# dtype: float64
# --------------------
# 2019-05-01 0.689051
# dtype: float64

重复时间索引

时间重采样

通过resample('新频率')进行重采样,结果是一个对象,需要通过sum()、mean()、max()、min()、median()、first()、last()、ohlc()(经济,开盘、最高、最低、收盘)显示

将时间序列从一个频率转换为另一个频率的过程,会有数据的填充或结合。

降采样:高频数据→低频数据,例如以天为频率的数据转换为以月为频率的数据,会有数据的结合 。

升采样:低频数据→高频数据,例如以年为频率的数据转换为以月为频率的数据,会有数据的填充。

ts = pd.Series(np.arange(1,9),index=pd.date_range(start = '2019/5/1',periods=8))
print(ts)
print('重采样:',ts.resample('3D'),' 数据类型',type(ts.resample('3D')))
print('重采样和值:',type(ts.resample('3D').sum()),'\n',ts.resample('3D').sum())
print('重采样均值:\n',ts.resample('3D').mean())
print('重采样最大值:\n',ts.resample('3D').max())
print('重采样最小值:\n',ts.resample('3D').min())
print('重采样中值:\n',ts.resample('3D').median())
print('重采样第一个:\n',ts.resample('3D').first())
print('重采样最后一个:\n',ts.resample('3D').last())
print('OHLC重采样:\n',ts.resample('3D').ohlc())
# 2019-05-01 1
# 2019-05-02 2
# 2019-05-03 3
# 2019-05-04 4
# 2019-05-05 5
# 2019-05-06 6
# 2019-05-07 7
# 2019-05-08 8
# Freq: D, dtype: int32
# 重采样: DatetimeIndexResampler [freq=<3 * Days>, axis=0, closed=left, label=left, convention=start, base=0] 数据类型<class 'pandas.core.resample.DatetimeIndexResampler'>
# 重采样和值: <class 'pandas.core.series.Series'>
# 2019-05-01 6
# 2019-05-04 15
# 2019-05-07 15
# Freq: 3D, dtype: int32
# 重采样均值:
# 2019-05-01 2.0
# 2019-05-04 5.0
# 2019-05-07 7.5
# Freq: 3D, dtype: float64
# 重采样最大值:
# 2019-05-01 3
# 2019-05-04 6
# 2019-05-07 8
# Freq: 3D, dtype: int32
# 重采样最小值:
# 2019-05-01 1
# 2019-05-04 4
# 2019-05-07 7
# Freq: 3D, dtype: int32
# 重采样中值:
# 2019-05-01 2.0
# 2019-05-04 5.0
# 2019-05-07 7.5
# Freq: 3D, dtype: float64
# 重采样第一个:
# 2019-05-01 1
# 2019-05-04 4
# 2019-05-07 7
# Freq: 3D, dtype: int32
# 重采样最后一个:
# 2019-05-01 3
# 2019-05-04 6
# 2019-05-07 8
# Freq: 3D, dtype: int32
# OHLC重采样:
# open high low close
# 2019-05-01 1 3 1 3
# 2019-05-04 4 6 4 6
# 2019-05-07 7 8 7 8

重采样resample()示例

对于降采样,如果resample()中设置参数closed='right',则指定间隔右边为结束,默认是采用left间隔左边为结束。【不是很明白】

ts = pd.Series(np.arange(1,9),index=pd.date_range(start = '2019/5/1',periods=8))
print(ts.resample('3D').sum())
print(ts.resample('3D',closed='right').sum())
'''[1,2,3],[4,5,6],[7,8]]'''
'''[(29,30)1],[2,3,4],[5,6,7],[8]'''
# 2019-05-01 6
# 2019-05-04 15
# 2019-05-07 15
# Freq: 3D, dtype: int32
# 2019-04-28 1
# 2019-05-01 9
# 2019-05-04 18
# 2019-05-07 8
# Freq: 3D, dtype: int32

重采样左右结束

对于降采样,如果resample()中设置lable='right',表示显示的标签为下一组里面的第一个标签,默认为当前分组的第一个标签。

ts = pd.Series(np.arange(1,9),index=pd.date_range(start = '2019/5/1',periods=8))
print(ts.resample('3D').sum()) #显示的标签为当前分组中的第一个标签
print(ts.resample('3D',label='right').sum()) #显示的标签为下一个分组中的第一个标签
#按照3D重采样,分组[1,2,3] [4,5,6] [7,8,9]
# 2019-05-01 6
# 2019-05-04 15
# 2019-05-07 15
# Freq: 3D, dtype: int32
# 2019-05-04 6
# 2019-05-07 15
# 2019-05-10 15
# Freq: 3D, dtype: int32

降采样显示标签

对于升采样,由于会增加标签,因此会出现空值问题,bfill()使用后面的值填充空值,ffill()使用前面的值填充空值。

ts = pd.Series(np.arange(1,4),index=pd.date_range(start = '2019/5/1',periods=3))
print(ts)
print(ts.resample('12H')) #对象
print(ts.resample('12H').asfreq()) #使用NaN填充空值
print(ts.resample('12H').bfill()) #使用后面的值填充空值
print(ts.resample('12H').ffill()) #使用前面的值填充空值
# 2019-05-01 1
# 2019-05-02 2
# 2019-05-03 3
# Freq: D, dtype: int32
# DatetimeIndexResampler [freq=<12 * Hours>, axis=0, closed=left, label=left, convention=start, base=0]
# 2019-05-01 00:00:00 1.0
# 2019-05-01 12:00:00 NaN
# 2019-05-02 00:00:00 2.0
# 2019-05-02 12:00:00 NaN
# 2019-05-03 00:00:00 3.0
# Freq: 12H, dtype: float64
# 2019-05-01 00:00:00 1
# 2019-05-01 12:00:00 2
# 2019-05-02 00:00:00 2
# 2019-05-02 12:00:00 3
# 2019-05-03 00:00:00 3
# Freq: 12H, dtype: int32
# 2019-05-01 00:00:00 1
# 2019-05-01 12:00:00 1
# 2019-05-02 00:00:00 2
# 2019-05-02 12:00:00 2
# 2019-05-03 00:00:00 3
# Freq: 12H, dtype: int32

升采样填充值

pandas之时间数据的更多相关文章

  1. Pandas:时间数据的季节分析

    最近在做论文的数据处理,涉及到不同年份不同季节的分析.另外还要求不同季节的数据可以单独分析. 其实思路还是比较简单的,那就在原始数据中增加一栏:季节 2013-05-21 Aotizhongxin 1 ...

  2. [数据清洗]-使用 Pandas 清洗“脏”数据

    概要 准备工作 检查数据 处理缺失数据 添加默认值 删除不完整的行 删除不完整的列 规范化数据类型 必要的转换 重命名列名 保存结果 更多资源 Pandas 是 Python 中很流行的类库,使用它可 ...

  3. [数据清洗]- Pandas 清洗“脏”数据(二)

    概要 了解数据 分析数据问题 清洗数据 整合代码 了解数据 在处理任何数据之前,我们的第一任务是理解数据以及数据是干什么用的.我们尝试去理解数据的列/行.记录.数据格式.语义错误.缺失的条目以及错误的 ...

  4. [数据清洗]- Pandas 清洗“脏”数据(三)

    预览数据 这次我们使用 Artworks.csv ,我们选取 100 行数据来完成本次内容.具体步骤: 导入 Pandas 读取 csv 数据到 DataFrame(要确保数据已经下载到指定路径) D ...

  5. [数据清洗]-Pandas 清洗“脏”数据(一)

    概要 准备工作 检查数据 处理缺失数据 添加默认值 删除不完整的行 删除不完整的列 规范化数据类型 必要的转换 重命名列名 保存结果 更多资源 Pandas 是 Python 中很流行的类库,使用它可 ...

  6. Pandas透视表处理数据(转)

    手把手教你用Pandas透视表处理数据(附学习资料) 2018-01-06 数据派THU 来源:伯乐在线 -  PyPer 本文共2203字,建议阅读5分钟.本文重点解释pandas中的函数pivot ...

  7. mysql中获取一天、一周、一月时间数据的各种sql语句写法

    今天抽时间整理了一篇mysql中与天.周.月有关的时间数据的sql语句的各种写法,部分是收集资料,全部手工整理,自己学习的同时,分享给大家,并首先默认创建一个表.插入2条数据,便于部分数据的测试,其中 ...

  8. Jquery小例子:全选按钮、加事件、挂事件;parent()语法;slideToggle()语法;animate()语法;元素的淡入淡出效果:fadeIn() 、fadeOut()、fadeToggle() 、fadeTo();function(e):e包括事件源和时间数据;append() 方法

    function(e): 事件包括事件源和事件数据,事件源是指是谁触发的这个事件,谁就是事件源(div,按钮,span都可以是事件源),时间数据是指比如点击鼠标的事件中,事件数据就是指点击鼠标的左建或 ...

  9. SQLServer学习笔记<>日期和时间数据的处理(cast转化格式、日期截取、日期的加减)和 case表达式

    日期和时间数据的处理. (1)字符串日期 ‘20080301’,这一串为字符串日期,但必须保证为四位的年份,两位的月份,两位的日期.例如,查询订单表日期大于‘20080301’.可以这样写: 1 se ...

随机推荐

  1. Github中添加SSH key

    1-创建密钥,在终端输入下面的命令 ssh-keygen -t rsa -b -C "你的邮箱" //双引号不能去 要求输入密码,建议回车使用空密码方便以后的每次连接,此时会生成一 ...

  2. 【Xamarin.Forms 3】页面类型

    系列目录 微信 1.[Xamarin.Forms 1]App的创建与运行 2.[Xamarin.Forms 2]App基础知识与App启动 知乎 1.[Xamarin.Forms 1]App的创建与运 ...

  3. Zuul请求超时

    最近在弄springcloud的时候发现在发送短信的时候zuul总是报错,错误信息如下 com.netflix.zuul.exception.ZuulException: at org.springf ...

  4. emacs-显示行号以及跳转到指定行

    [显示行号]M+x display-line-number-mode <Return> [跳转行号]M+x goto-line 然后输入你想跳转到的行号 <Return> (在 ...

  5. Solaris 11.4安装,映像包管理系统(IPS)搭建

    文章目录 1.下载地址 2. IPS安装准备 2.1 repo包 2.1 install-repo.ksh 2.2 校验文本 3. Solaris系统安装 3.1 虚拟机软件 3.2 安装os 3.3 ...

  6. redis.cluster/memcached.cluster/wmware esxi

    1. 安装配置redis的cluster 集群 redis 集群高可用 实验环境 192.168.198.131 openvpn-server #42-Ubuntu SMP Mon Jun 8 14: ...

  7. 每日一题 - 剑指 Offer 32 - I. 从上到下打印二叉树

    题目信息 时间: 2019-06-25 题目链接:Leetcode tag:BFS(广度优先搜索) 队列 难易程度:中等 题目描述: 从上到下打印出二叉树的每个节点,同一层的节点按照从左到右的顺序打印 ...

  8. 基于 React 开发了一个 Markdown 文档站点生成工具

    Create React Doc 是一个使用 React 的 markdown 文档站点生成工具.就像 create-react-app 一样,开发者可以使用 Create React Doc 来开发 ...

  9. P4408 逃学的小孩 题解

    题目描述 Chris家的电话铃响起了,里面传出了Chris的老师焦急的声音:"喂,是Chris的家长吗?你们的孩子又没来上课,不想参加考试了吗?"一听说要考试,Chris的父母就心 ...

  10. 【华为云技术分享】跟唐老师学习云网络 : Kubernetes网络实现

    当今K8s独霸天下之时,咱们站在更高的角度,好好的看看K8s网络是以什么理念构筑的.以及一个容器集群的好保姆,是如何分别照顾 南北流量和东西流量的. 一.简单介绍下Kubernetes 略..容器集群 ...