
python
摔跤吧儿
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python脚本打包为exe的方法
安装较慢的话可以尝试换源。原创 2023-04-07 15:03:14 · 212 阅读 · 1 评论 -
python requirements.txt
原创 2022-05-16 15:57:26 · 383 阅读 · 0 评论 -
python joblib多进程执行任务
Joblib是一个可以简单地将Python代码转换为并行计算模式的软件包,它可非常简单并行我们的程序,从而提高计算速度。Joblib是一组用于在Python中提供轻量级流水线的工具。 它具有以下功能:透明的磁盘缓存功能和“懒惰”执行模式,简单的并行计算Joblib对numpy大型数组进行了特定的优化,简单,快速。from joblib import Parallel, delayeddef func(param1, param2): return param1 + param2 res_l原创 2022-05-15 19:19:48 · 1091 阅读 · 0 评论 -
matplotlib设置图例的位置及排列布局
plt.legend(handles=[l1[0],l2[0],l3[0]], loc='center', bbox_to_anchor=(0.5, 1.09), ncol=3, prop={'family':"Times New Roman", 'size':fontsize})l1,l2,l3为ax.plot(… , label=‘图例参数名称’)的返回值。设置图例位置loc的取值有9种,参考知乎大佬,当只设置loc值时,参考下图。当设置bbox_to_anchor时bbox_to_a.原创 2022-03-26 16:45:22 · 4573 阅读 · 0 评论 -
matplotlib windows 使用中文字体
主要参考这篇博客坐标轴,标题使用特定字体from matplotlib import pyplot as pltfrom matplotlib.font_manager import FontProperties...ax.set_ylabel('Value', fontproperties=FontProperties(family="Times New Roman", size=fontsize)) # 使用Times New Roman字体plt.title('典型的KPI变化类型', f原创 2022-03-26 16:12:23 · 1163 阅读 · 0 评论 -
tensorflow1.x和2.x限制使用显存大小
tf 1.x的方法By default, TensorFlow maps nearly all of the GPU memory of all GPUs (subject toCUDA_VISIBLE_DEVICES)visible to the process. This is done to more efficiently use the relativelyprecious GPU memory resources on the devices by reducing memoryfr原创 2021-08-16 22:36:00 · 462 阅读 · 0 评论 -
tensorflow1.x官方文档查看方法
现在直接搜tensorflow doc出来的官网默认都是最新版的文档官方文档在1.15之前的都需要在github上查看,发现好像在网页上好像直接看不太方便,只能clone下来git clone https://github.com/tensorflow/docs.git -b 所需版本对应分支clone下来后,进入本地文件夹,文档都是markdown格式,基本上英文版的都在这个目录下也可以根据关键字在编辑器里全局搜索...原创 2021-08-16 22:23:32 · 959 阅读 · 0 评论 -
np.array中切分子矩阵时的注意事项
当需要从一个2维矩阵中切分出一个子矩阵时,给定了切分的index_listimport numpy as npa = np.array([ [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16],])index_list = [1, 2, 3]# 要得到[[6,7],[10,11]]# 得不到对应的子矩阵print(a[index_list, index_list])# 切分子矩阵的正确姿原创 2021-08-14 20:32:25 · 133 阅读 · 0 评论 -
np.savetxt用法
np.array对应保存为txt文件的快捷方式,不要在for循环写入文件了官方文档在多指标时间序列问题中频繁需要数据的处理和转化np.savetxt()参数:fname:保存文件路径X:保存np对象fmt:保存的数据格式delimiter:分隔符,默认为逗号,可以自己指定import numpy as npa = np.array([ [1, 2, 3], [4, 5, 6], [7, 8, 9]])np.savetxt('a.txt', a, delimi原创 2021-08-14 20:18:17 · 8883 阅读 · 0 评论 -
np.where用法
官方文档两种用法1.确定一个array中满足条件的索引列表>>> import numpy as np>>> a = np.arange(10)>>> np.where(a < 5)(array([0, 1, 2, 3, 4], dtype=int64),)注意这里返回的是一个元组,需要获取到索引列表还需要[0]来访问返回结果的第一个元素2.根据条件返回和原array形状一致的array>>> import n原创 2021-08-14 20:02:32 · 161 阅读 · 0 评论 -
pip安装依赖于github的第三方库
1.pip在线安装pip install git+https://github.com/thu-ml/zhusuan.githttps替换为git就是使用ssh协议pip install vcs+protocol://repo_url2.通过requirements.txt安装requirements.txtgit+https://github.com/thu-ml/zhusuan.git执行pip install -r requirements.txt3.离线安装pip源可以使原创 2021-08-14 19:30:45 · 2843 阅读 · 0 评论