Python
悠悠的数据分析基地
希望影响一大群人一起做数据分析。(就,挺奇怪的梦想)
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
list indices must be integers or slices, not tuple解决方案-python学习笔记
原因:多个[]的数组之间没加,逗号 源码: import numpy as np a = np.array([[1,2][3,4]]) print(a) 报错: TypeError: list indices must be integers or slices, not tuple 修改方法: 在[1,2]后面加个英文逗号, import numpy as np a = np.array([[1,2],[3,4]]) print(a) ...原创 2021-07-27 13:53:58 · 3264 阅读 · 0 评论 -
numpy库创建数组的四种方式-Python数据分析笔记
#方式一:使用numpy.arrary创建 a = np.array([1,2,3,4]) print(a) 结果: #方式二:用arange创建。可指定起始和终止数据,以及步长等 b = np.arange(0,10,2) print(b) 结果: #方式三:用random模块来创建数组 #3.1 用random.random创建一个N行N列的数组,其中里面的值是0-1之间的随机数。 c = np.random.random((2,3)) print(c) 结果: #3.2 ...原创 2021-07-26 23:22:37 · 1355 阅读 · 0 评论
分享