# 这个data_matrix[:,dimen] <= thresh_val 内标会返回data_matrix当中的值符合条件的,返回为True
# ret_array 中就会返回 下标为True的值
ret_array[data_matrix[:,dimen] <= thresh_val] = -1.0 # https://www.cnblogs.com/prolifes/articles/5195528.html
# 亲测季度可用 #coding=utf-8
import datetime
from datetime import timedelta now = datetime.datetime.now() #今天
today = now #昨天
yesterday = now - timedelta(days=1) #明天
tomorrow = now + timedelta(days=1)<br><br>#当前季度 now_quarter = now.month / 3 if now.month % 3 == 0 else now.month / 3 + 1 #本周第一天和最后一天
this_week_start = now - timedelta(days=now.weekday())
this_week_end = now + timedelta(days=6-now.weekday()) #上周第一天和最后一天
last_week_start = now - timedelta(days=now.weekday()+7)
last_week_end = now - timedelta(days=now.weekday()+1) #本月第一天和最后一天
this_month_start = datetime.datetime(now.year, now.month, 1)
this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) #上月第一天和最后一天
last_month_end = this_month_start - timedelta(days=1)
last_month_start = datetime.datetime(last_month_end.year, last_month_end.month, 1) #本季第一天和最后一天
month = (now.month - 1) - (now.month - 1) % 3 + 1
this_quarter_start = datetime.datetime(now.year, month, 1)
this_quarter_end = datetime.datetime(now.year, month + 3, 1) - timedelta(days=1) #上季第一天和最后一天
last_quarter_end = this_quarter_start - timedelta(days=1)
last_quarter_start = datetime.datetime(last_quarter_end.year, last_quarter_end.month - 2, 1) #本年第一天和最后一天
this_year_start = datetime.datetime(now.year, 1, 1)
this_year_end = datetime.datetime(now.year + 1, 1, 1) - timedelta(days=1) #去年第一天和最后一天
last_year_end = this_year_start - timedelta(days=1)
last_year_start = datetime.datetime(last_year_end.year, 1, 1)

最新文章

  1. ascii、unicode、utf、gb等编码详解
  2. [web建站] 优课急送《零基础快速学习建站》视频+课件【价值399元】
  3. (三)Bootstrap.jar
  4. ELF Format 笔记(二)—— ELF Header
  5. 读书摘要,Hackable Projects
  6. PMP 第三章 单个项目的项目管理标准
  7. HDU 5805 NanoApe Loves Sequence (思维题) BestCoder Round #86 1002
  8. uploadify 上传文件出现HTTP 404错误
  9. css的继承、层叠和特殊性
  10. 转:php使用websocket示例详解
  11. POJ1159 Palindrome(数位DP)
  12. 通过OCI 处理 Oracle 10g 中处理Clob大字段写入
  13. Codeforces 459E Pashmak and Graph(dp+贪婪)
  14. Java虚拟机之性能监控
  15. Alpha冲刺No.6
  16. Spring MVC 使用介绍(八)—— 类型转换
  17. Mysql多实例安装笔记
  18. RN全局的变量,方法,全局类,全局类方法
  19. windows的网上邻居
  20. (转)java基础-反射

热门文章

  1. InnoDB: Error: log file .\ib_logfile0 is of different size 0 10485760 bytes
  2. Android 自己定义UI圆角button
  3. 《Head First 设计模式》学习笔记——代理模式
  4. android学习笔记:adb更换端口后成功启动
  5. MapReduce04
  6. mysql20170407代码实现
  7. ASP.NET_SessionId vs .ASPXAUTH why do we need both of them?
  8. POJ 3264 Balanced Lineup 区间最值
  9. canvas做的时钟,学习下
  10. 【XSY3209】RGB Sequence