生成指定范围内的指定个数的一维数组
arr = np.random.uniform(45.0,55,1000) # 浮点型
arr = np.random.randint(45.0,55,1000) # 整数
# 生成0-1之间的随机浮点数,个数为1000
arr = np.random.random(1000)
lon_array = np.linspace(115, 125, 500) # 等差数列数据
时间格式化转换
字符串转时间格式
import datetime
dt = '20211026'
tmp = datetime.datetime.strptime(dt,'%Y%m%d')
’‘’
年月日-'%Y%m%d'
‘’‘
print(tmp)
daynum = '2021310'
day = datetime.datetime.strptime(daynum ,'%Y%j')
2021-10-26 00:00:00
2021-11-06 00:00:00
时间转字符串
daynum = '2021310'
TIME = datetime.datetime.strptime(daynum ,'%Y%j')
stm = TIME.strftime('%Y%m%d%H%M%S')
‘20211106000000’