摘要: 新建文本文档,写入以下代码。 后缀改成.reg,双击运行后重启电脑。 Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer] "Link"= 阅读全文
posted @ 2022-07-21 10:23 C羽言 阅读(609) 评论(0) 推荐(0)
摘要: %%timeit stgg=np.where(df['close']>df['open'],df['close'],df['open']) stdd=np.where(df['close']<df['open'],df['close'],df['open']) #196 µs ± 1.72 µs p 阅读全文
posted @ 2022-07-20 13:47 C羽言 阅读(80) 评论(0) 推荐(0)
摘要: How to calculate df.cummin() piecewise I want to start df.cummin() when cond column is true until recompute df.cummin() next cond column is true. The 阅读全文
posted @ 2022-07-17 20:31 C羽言 阅读(25) 评论(0) 推荐(0)
摘要: %%timeit def compare(A, B): x = A[0] out = [] for a,b in zip(A,B): if b>x: out.append(True) x = a else: out.append(False) return out df['compare'] = c 阅读全文
posted @ 2022-07-16 21:03 C羽言 阅读(51) 评论(0) 推荐(0)
摘要: input import pandas as pd import numpy as np A=[17,18,21,15,18,19,22,16,30,50,] cond=[False,True,False,False,False,True,False,False,True,False] df=pd. 阅读全文
posted @ 2022-07-14 22:33 C羽言 阅读(30) 评论(0) 推荐(0)
摘要: input import pandas as pd import numpy as np d={'trade_date':['2021-08-10','2021-08-11','2021-08-12','2021-08-13','2021-08-14','2021-08-15','2021-08-1 阅读全文
posted @ 2022-07-11 09:13 C羽言 阅读(52) 评论(0) 推荐(0)
摘要: 我们可以使用 numba解决方案: from numba import jit @jit def dyn_shift(s, step): assert len(s) == len(step), "[s] and [step] should have the same length" assert i 阅读全文
posted @ 2022-07-07 19:25 C羽言 阅读(61) 评论(0) 推荐(0)
摘要: ipython中查看代码执行时间的魔法命令 %time: 在行模式下,代码运行一次所花费的时间。%%time:在单元模式下,代码运行一次所花费的时间。 %timeit: 在行模式下,执行代码块若干次,取最佳结果。%%timeit: 在单元模式下,执行代码块若干次,取最佳结果。 PyCharm里效率测 阅读全文
posted @ 2022-07-04 16:44 C羽言 阅读(159) 评论(0) 推荐(0)
摘要: 假设您的数据帧名为“df”,运行这一行,您将把数据保存到剪贴板,让您可以将其粘贴到需要的地方 df.to_clipboard(excel=True) 阅读全文
posted @ 2022-07-02 13:14 C羽言 阅读(1244) 评论(0) 推荐(0)
摘要: 这样看的话,就是交叉比较,每一个值都只和另一列的上一行值有关,那么我们完全可以将a列和b列拆分开,按照这种交叉形式重新组合出c列和d列,也就是将a列和b列的每个元素交叉互换一下。 a = [0, 1, 2, 3] b = [a, b, c, d] c = [0, b, 2, d] d = [a, 1 阅读全文
posted @ 2022-07-02 09:32 C羽言 阅读(54) 评论(0) 推荐(0)