Cousera Notebook 之 Python 备份记录


最近在coursera学习一系列课程,MATLAB和Python混着使,总是傻傻弄不清python里numpy的一些使用规则,所以直接贴一个在这里,好让自己查找:
参考网址: Numpy Manual v1.19

Coursera的notebook下载方式

参考博客
1.登陆进主界面
2.新建python notebook
3.输入:

!tar cvfz allfiles.tar.gz *

4.主界面会出现名叫:allfiles.gz的文件,点击并下载

PS 5.如果太大的话:(或者是下载不下来了,就是需要分开 再合起来…)

!split -b 200m allfiles.tar.gz allfiles.tar.gz.part.

然后全部下载好后,在cmd中

cat allfiles.tar.gz.part.* > allfiles.tar.gz

在window下命令有所不同,首先cd Desktop里
然后

copy /b utf-8''allfiles.tar.gz.part.*  allfiles.tar.gz

在本地的Anaconda里下载opencv

问题:anaconda安装opencv Solving package specifications一直转圈圈
解决方法:
1、在anaconda prompt输入:

conda upgrade --all

2、等待一个done 全部完成
3、再次打开anaconda搜索opencv点击Apply(我是3mins左右就好了 继续apply 安装总共大概10mins就完成了)

重置Jupyter 还原最初状态

Rename your existing Jupyter Notebook within the individual notebook view
In the notebook view, add “?forceRefresh=true” to the end of your notebook URL
Reload the screen
You will be directed to your home Learner Workspace where you’ll see both old and new Notebook files.
Your Notebook lesson item will now launch to the fresh notebook.

首先点进去一份作业,保持在作业页,如图

重命名此程序名,如图,点确定

在浏览器最后加入:?forceRefresh=true

按下键盘Enter键,随后再次进入作业即可看到原来的初始作业。

matplotlib的图显示在Jupyter notebook里面/外面

%matplotlib inline

%matplotlib inline #显示在里面
plt.violinplot(dataset=np.random.randn(2000, 10)+ np.random.randn(10))# uniform distribution + np.random.randn(10))
plt.show()

%matplotlib qt

%matplotlib qt #显示在外面的交互界面
plt.violinplot(dataset=np.random.randn(2000, 10))# uniform distribution + np.random.randn(10))
plt.show()

numpy.zeros

numpy.zeros(shape, dtype=float, order=‘C’)
返回给定好row,clo内部全为零的数组

>>> np.zeros(5)
array([ 0.,  0.,  0.,  0.,  0.])
>>> np.zeros((5,), dtype=int)
array([0, 0, 0, 0, 0])
>>> np.zeros((2, 1))
array([[ 0.],
		   [ 0.]])

numpy.random.rand

numpy.random.rand(d0, d1, …, dn)

>>> np.random.rand(3,2)
array([[ 0.14022471,  0.96360618],  #random
       [ 0.37601032,  0.25528411],  #random
       [ 0.49313049,  0.94909878]]) #random

OS: 比如这里就和zeros,ones不一样了… 括号没了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Kin-Zhang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值