![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
cissy930426
这个作者很懒,什么都没留下…
展开
-
array与matrix
两个array的相乘*指的是对应元素的相乘;两个array的dot表示矩阵的相乘。若a是array,则a.T表示转置。把array转换为matrix用asmatrix()多数numpy函数返回的是array类型,不是matrix类型。把array转换为matrix用asmatrix()多数numpy函数返回的是array类型,不是matrix类型。原创 2016-04-03 23:19:27 · 630 阅读 · 0 评论 -
Python中排序sort 、sorted和argsort函数
sort函数是list列表中的函数,而sorted可以对list或者iterator进行排序用sort函数对列表排序时会影响列表本身,而sorted不会>>> a = [1,2,1,4,3,5] >>> a.sort() >>> a[1, 1, 2, 3, 4, 5]>>> a = [1,2,1,4,3,5] >>> sorted(a) [1, 1, 2, 3, 4, 5原创 2016-04-04 11:48:46 · 8909 阅读 · 0 评论 -
安装ipython时python setup.py egg_info错误的解决办法
在Mac OS X中安装IPython:python -VPython 2.7.6pip -Vpip 8.1.1 from /Library/Python/2.7/site-packages (python 2.7)使用sudo pip install ipython指令安装ipython,运行结果出现The directory '/Users/home/Library/Caches/pip/原创 2016-04-05 23:42:44 · 98983 阅读 · 7 评论 -
python中np.random.randint()
In [1]:np.random.randint(8,10,size = 20)Out[1]:array([8, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 8, 8, 9, 8, 9, 9, 9, 8, 8])In [2]:np.random.randint(2,size = 20)Out[2]:array([1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0,原创 2016-04-10 13:48:16 · 8630 阅读 · 0 评论