用 DolphinDB Python API 从 DolphinDB server 取数,然后通过 python 把数据交互进 GPU 进行深度学习模型训练。 DolphinDB 提供高效的 python 取数接口。 Python API 使用教程:python 取数教程链接
回答于 2023-03-17 14:02
可以尝试以下这个方法: dataVector = 2021.01.01..2021.02.28 dataVector[at(0..(size(dataVector)-1)%5==0)]
回答于 2023-03-16 21:03
可以使用DolphinDB的repartitionDS函数满足上述需求,具体例子如下: ds = repartitionDS(query=<select DateTime,SecurityID from loadTable("dfs://SH_TSDB_snapshot_MultiColumn", "snapshot") where date(DateTime) in 2021.12.01 2021.12.06 2021.12.07, SecurityID in `600021`603659>, column=`SecurityID, p...
回答于 2023-03-13 09:19
以查询一个分区表的所有股票值为例: ds=sqlDS(<select SecurityID from loadTable( "dfs://SH_TSDB_snapshot_MultiColumn", "snapshot") where date(DateTime)=2021.12.01>) def disctcode(t){ return select distinct(SecurityID) as SecurityID from t } data = distinct(mr(ds, disctcode, ,unionAll{,false})...
回答于 2023-03-09 19:48
可以尝试一下这种方法: dbName = "dfs://SH_TSDB_snapshot_MultiColumn" tbName = "snapshot" pt = loadTable(dbName, tbName) replayDate = 2021.12.01 ds = sqlDS(<select DateTime,SecurityID from pt where date(DateTime)=replayDate, time(DateTime)>=09:30:00.000>) def disctcode(t){ r1 = select dist...
回答于 2023-03-09 19:44
可以尝试以下下面的代码: syms = "A" datetimes = 2021.01.01..2022.01.01 n = 200 t = table(take(datetimes,n) as trade_time, take(syms,n) as sym,take(500+rand(10.0,n), n) as price) dayNum = 3 tbName = "t" def getLastNDay(tbName, dayNum){ colName = "price" scripts = "update " + tbName...
回答于 2023-01-29 10:19
可以在DolphinDB python api时设置下面两个参数,让会话在网络异常的情况下不中断: (1)调用connect函数时,设置keepAliveTime参数 keepAliveTime:通过配置 keepAliveTime 参数可以设置 TCP 的存活检测机制的检测时长,从而能够在网络不稳定条件下,及时释放半打开的 TCP 连接。默认值为30秒。 keepAliveTime主要是网...
回答于 2023-01-29 10:00
可以参考下面的自定义函数,作用是删除当前节点上的所有流计算引擎: def DropAllEngines(){ if(getStreamEngineStat().rows() > 0){ engineTypes = getStreamEngineStat().keys() for(engineType in engineTypes){ engineNum = size(getStreamEngineStat()[engineType]) i = 0 do{ print("Drop Str...
回答于 2022-11-25 09:57
可以参考下面的自定义函数,作用是清除当前节点的所有流计算相关的订阅: def ClearAllSubscriptions(){ if(getStreamingStat().pubTables.rows() > 0){ do{ try{ tableName = getStreamingStat().pubTables[0,0] actionName = getStreamingStat().pubTables[0,3] actionName = strReplace(actionNa...
回答于 2022-11-25 09:55