我的数据带有Monday, January 29, 2018 12:00 AM
日期,如何输出所有上次日期为| 1 | Monday, January 29, 2018 12:00 AM |
| 2 | Monday, January 29, 2018 12:00 AM |
| 3 | Monday, January 29, 2018 12:00 AM |
| 4 | Monday, January 28, 2018 12:00 AM |
| 5 | Monday, January 28, 2018 12:00 AM |
| 6 | Monday, January 28, 2018 12:00 AM |
| 7 | Monday, January 27, 2018 12:00 AM |
| 8 | Monday, January 27, 2018 12:00 AM |
| 9 | Monday, January 27, 2018 12:00 AM |
的记录?
import numpy as np
x = np.array([1, 3, 6, 1, -5, 6, 4, 1, 6])
def running_diff(arr, N):
return np.array([arr[i] - arr[i-N] for i in range(N, len(arr))])
running_diff(x, 4) # array([-6, 3, -2, 0, 11])
答案 0 :(得分:0)
这应该适合你:
select * from table where extract(dow from date_field) = 1
1是星期一 7是星期天