我从一个csv读取数据,然后循环,然后我想除以平均值来规范化它,但得到一个警告。代码是:A = genfromtxt("train.txt", delimiter=';', skip_header=1)

lowid = A[:,1].min(axis=0)

highid = A[:,1].max(axis=0)

X = []

Y = []

for i in np.arange(lowid, highid):

I = A[A[:,1] == i][:, [0,2,3]]

meanp = np.mean(I[:,1]);

meanq = np.mean(I[:,2]);

for j in np.arange(I[:,0].min(axis=0)+2, I[:,0].max(axis=0)):

weekday = int(I[j,0]) % 7

# NORMALIZE:

P = I[j,1] / meanp

pP = I[j-1,1] / meanp

ppP = I[j-2,1] / meanp

X.append([weekday, P, pP, ppP])

Y.append(I[j,2])

在火车.txt看起来像这样:

^{pr2}$

警告:weekday = int(I[j,0]) % 7

DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future

P = I[j,1] / meanp

DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future

pP = I[j-1,1] / meanp

DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future

ppP = I[j-2,1] / meanp

DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future

Y.append(I[j,2])

DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future

有什么问题吗?

谢谢

编辑好吧,我自己也很快就搞定了:

j必须是整数类型。我是这样修好的:for j in range(int(I[:,0].min(axis=0))+2, int(I[:,0].max(axis=0))):

这样的好办法?我是python新手。。。在

python的division函数_Python/Numpy:Division给了我一个意外的弃用警告相关推荐

  1. python排大小函数_python numpy 一些函数 大小排序和统计

    排序大小函数 import numpy as np size = 100 a = np.random.randint(0, 1000, size=size) print(a) # 排序之后的前k个元素 ...

  2. python中grid函数_Python / NumPy中meshgrid的目的是什么?

    实际上文档中已经提到了np.mgrid的目的: np.mgrid 从坐标向量返回坐标矩阵. 在给定一维坐标数组x1,x2,...,xn的情况下,为N-D网格上的N-D标量/矢量场的矢量化评估制作N-D ...

  3. python中squeeze函数_Python numpy.squeeze()用法及代码示例

    当我们要从数组形状中删除一维条目时,将使用numpy.squeeze()函数. 用法: numpy.squeeze(arr, axis=None ) 参数: arr :[数组]输入数组. axis : ...

  4. python中isin函数_Python numpy.isin函数方法的使用

    numpy.isin numpy.isin(element, test_elements, assume_unique=False, invert=False)     [source] 计算test ...

  5. python 中arange函数_Python numpy.arange函数方法的使用

    numpy.arange numpy.arange([start, ]stop, [step, ]dtype=None) 返回给定间隔内的均匀间隔的值. 在半开间隔[start,stop)(换句话说, ...

  6. python的std函数_Python numpy.nanstd函数方法的使用

    numpy.nanstd numpy.nanstd(a, axis=None, dtype=None, out=None, ddof=0, keepdims= 忽略NaN时,计算沿指定轴的标准偏差. ...

  7. python中argmin函数_Python numpy.argmin()用法及代码示例

    numpy.argmin(array,axis = None,out = None):返回特定轴上数组min元素的索引. 参数: array:Input array to work on axis : ...

  8. python中mat函数_Python Numpy中的Matlab cell2mat函数?

    从某种意义上说,Python的"cells"比MATLAB-list长得多.python列表是1d单元格(或者更确切地说,大小为1维的单元格)的直接替代品.二维单元格可以表示为嵌套 ...

  9. python中reshape函数_Python numpy.reshape函数方法的使用

    numpy.reshape numpy.reshape(a, newshape, order='C')    [source] 在不更改数据的情况下为数组赋予新的shape.参数 :a :array_ ...

最新文章

  1. java 邮件模板_Spring Boot 优雅地发送邮件
  2. 《南溪的目标检测学习笔记》——权重初始化
  3. Amazon S3 API
  4. JS 获取宽,高(ie未测)
  5. 时空解析理论的实验检验方法
  6. win7创建桌面计算机,win7系统添加或删除虚拟桌面的方法介绍
  7. table-首列冻结
  8. LeetCode148经典题目记录(链表排序:快排+递归归并+迭代归并)
  9. 论文笔记:A novel DRM scheme for accommodating expectations of personal use
  10. 可爱又能干的小精灵—送餐机器人来啦
  11. 在线TSV转SQL工具
  12. 维基解密又双叒叕曝光了 CIA 针对 Mac 和 Linux 的 3 个黑客工具
  13. linux 怎么看节点核数,Linux怎么查看CPU核数?-linux运维
  14. Mysql建表——报错1005
  15. Excel导出功能超时解决方案 -- 异步处理
  16. IOS 应用内打开三方地图app直接导航(高德坐标)
  17. Scratch少儿编程与游戏:狙击黑蝙蝠
  18. hypermill后处理构造器安装_ug10后处理安装步骤ug后处理在什么位置ug法兰克后处理下载ug后处理器如何设置ug后处理构造器...
  19. 「CTSC2017」吉夫特(Gift) (Lucas定理,状压DP)
  20. Get、Put、Post、Delete 含义与区别

热门文章

  1. 清除number输入框的上下箭头
  2. [Leetcode]@python 68. Text Justification
  3. 全排列算法原理和实现
  4. JS设置CSS样式的集中方式
  5. 极简_Gradle多Module项目组建
  6. django-web聊天
  7. 揭秘!如何快速提高网站权重-关键词百度指数叠加
  8. js plugin--headroom
  9. CSS 编码中超级有用的工具集合
  10. 让DNN为您的手机提供内容