Python
sTevenLI6639
这个作者很懒,什么都没留下…
展开
-
TF2.8 CPU及GPU速度测试
测试CPU及GPU在TF下面的速度差异import tensorflow as tfimport timedef time_matmul(x): start = time.time() range_1 = 1000 for loop in range(range_1): tf.matmul(x, x) result = time.time()-start print("{} loops: {:0.2f}ms".format(range_1,1000*result))原创 2022-04-05 20:54:13 · 515 阅读 · 0 评论 -
Matplotlib绘图跳过空时间段的处理方案(原创)
Matplotlib绘图跳过时间段的处理方案Matplotlib绘图跳过时间段的处理方案(原创)Matplotlib绘图跳过时间段的处理方案(原创)股票绘图需要跳过非交易时段绘连续图, 方法很简单:将时间格式转成文本格式即可:// 将时间格式转成文本格式, index.strftime("%m%d%H%M") x = stock_data_ana.index.strftime("%m%d%H%M") ax.set_xticklabels(x, rotation = 45) # x原创 2021-06-18 20:16:38 · 1342 阅读 · 0 评论 -
原创 - Pandas 自构Vlookup简单函数 - 避免掉坑
原创 - Pandas 自定义Vlookup函数Pandas没有Vlookup函数, 其它文章的自构函数也不好用.因此自己弄了一个,分享一下.Pandas没有Vlookup函数, 其它文章的自构函数也不好用.因此自己弄了一个,分享一下.// Vlookup Func:def vlookup(data_1, data, columns , na = 0): data_1['vlookup'] = '' data_2_vlookup['vlookup'] ='' for i in原创 2021-02-14 23:19:08 · 449 阅读 · 1 评论 -
Tensorflow 2环境下,程序快速测试 GPU是否安装成功
Python 测试 TensorFlow2(GPU)是否安装成功 2020-8软件环境:Tensorflow-gpu 2.3.0AnacondaPython 3.8GPU#TF2 GPU测试import tensorflow as tffor i in tf.config.list_physical_devices(): if 'GPU' in i[1]: print (i[1],'可用,GPU名称: ',i[0])结果显示:XLA_GPU 可用,GPU名称:原创 2020-08-22 15:39:32 · 3302 阅读 · 2 评论