会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
首页
新随笔
订阅
管理
上一页
1
···
135
136
137
138
139
140
141
142
143
···
337
下一页
2021年1月29日
Python lambda 介绍
摘要: func_1=lambda x:x+1 print(func_1(3)) #4 print(func_1(7)) #8 #lambda作为一个表达式,定义了一个匿名函数,上例的代码x为入口参数,x+1为函数体,用函数来表示为: def func_1(x): return (x+1) 也可以这样使用:
阅读全文
posted @ 2021-01-29 10:04 emanlee
阅读(399)
评论(0)
推荐(0)
2021年1月28日
pip 安装turtle
摘要: install turtle时,错误如: C:\Users\Administrator>pip install turtleCollecting turtle Using cached turtle-0.0.2.tar.gz (11 kB) ERROR: Command errored out wi
阅读全文
posted @ 2021-01-28 18:03 emanlee
阅读(603)
评论(0)
推荐(0)
2021年1月27日
Python 列表嵌套多种实现方式
摘要: list 中 套着 list l = [[1,2],[3,4],[[5,6],[7,8]]] # 如何打印输出字符 5 print(l[2][0][0]) # 该如何理解呢? 去掉外层的嵌套 xx = [[1],[2]] yy= [i[0] for i in xx] print(xx) print(
阅读全文
posted @ 2021-01-27 23:39 emanlee
阅读(1045)
评论(0)
推荐(0)
python:[numpy] ndarray 与 list 互相转换
摘要: python:[numpy] ndarray 与 list 互相转换 # list 转 numpy np.array(list1) # ndarray 转 list array1.tolist() python如何把series转化为list直接list(series)就可以
阅读全文
posted @ 2021-01-27 23:20 emanlee
阅读(6567)
评论(0)
推荐(1)
PyTorch使用GPU的方法
摘要: PyTorch可以指定用来存储和计算的设备,如使用内存的CPU或者使用显存的GPU。在默认情况下,PyTorch会将数据创建在内存,然后利用CPU来计算。 PyTorch要求计算的所有输入数据都在内存或同一块显卡的显存上。 检测是否可以使用GPU,使用一个全局变量use_gpu,便于后面操作使用 u
阅读全文
posted @ 2021-01-27 22:23 emanlee
阅读(15875)
评论(0)
推荐(0)
Matplotlib.pyplot 把画图保存为图片 指定图片大小
摘要: Matplotlib.pyplot 把画图保存为图片 在plt.show()之前执行 plt.savefig() 函数即可。 简单例子: import matplotlib.pyplot as plt x=[1,2,3,4,5] y=[10,5,15,10,20] plt.plot(x,y,'ro-
阅读全文
posted @ 2021-01-27 22:01 emanlee
阅读(17253)
评论(0)
推荐(0)
python列表中的所有值转换为字符串,以及列表拼接成一个字符串
摘要: list1 = [1,2,3,4,5] list2 = [str(i) for i in list1] list3 = ','.join(list2)
阅读全文
posted @ 2021-01-27 21:55 emanlee
阅读(826)
评论(0)
推荐(0)
python 读取中文文件名/中文路径
摘要: 如果文件名,路径名称,字符串中含有中文汉字,文件头加上这个: #!/usr/bin/python #-*- coding:cp936 -*- 例如: #!/usr/bin/python #-*- coding:cp936 -*- file = 'E:/_申请/横向/'
阅读全文
posted @ 2021-01-27 19:58 emanlee
阅读(4090)
评论(0)
推荐(0)
在Python中使用LSTM和PyTorch进行时间序列预测(深度学习时序数据预测)
摘要: https://zh.gluon.ai/chapter_recurrent-neural-networks/lang-model.html 翻译自: https://stackabuse.com/seaborn-library-for-data-visualization-in-python-par
阅读全文
posted @ 2021-01-27 14:34 emanlee
阅读(9686)
评论(0)
推荐(0)
记录分析python程序运行时间的几种方法
摘要: import datetimeimport timestart = time.time()time.sleep(2) ### 你的代码end = time.time()mystr="run time: %d seconds" % ( end-start)print(mystr)
阅读全文
posted @ 2021-01-27 09:10 emanlee
阅读(789)
评论(0)
推荐(1)
上一页
1
···
135
136
137
138
139
140
141
142
143
···
337
下一页