码:
import subprocess
def printit():
for i in range(6):
for j in range(6):
query = "select rxpkts, txpkts from ./log.csv where datapath = "+str(i)+" and port = "+str(j)
fileName = str(i)+"_"+str(j)+".csv"
with open(fileName, "w+"):
p = subprocess.Popen(["python", "q", "-H", "-d", ",", query], stdout=fileName)
printit()
Run Code Online (Sandbox Code Playgroud)
错误:
$ python processLog.py
Traceback (most recent call last):
File "processLog.py", line 11, in <module>
printit()
File "processLog.py", line 9, in printit
p = subprocess.Popen(["python", "q", "-H", "-d", ",", query], stdout=fileName)
File "/usr/lib/python2.7/subprocess.py", line 702, in …Run Code Online (Sandbox Code Playgroud) 试图安装xgboost失败..?该版本是Windows和企业版的Anaconda 2.1.0(64位).我该怎么办?我一直在使用R似乎很容易从RStudio在R中安装新软件包,但是在spyder中不是这样,因为我需要去命令窗口来做它然后在这种情况下它失败了..
import sys
print (sys.version)
2.7.8 |Anaconda 2.1.0 (64-bit)| (default, Jul 2 2014, 15:12:11) [MSC v.1500 64 bit (AMD64)]
C:\anaconda\Lib\site-packages>pip install -U xgboost
Downloading/unpacking xgboost
Could not find a version that satisfies the requirement xgboost (from versions: 0.4a12, 0.4a13)
Cleaning up...
No distributions matching the version for xgboost
Storing debug log for failure in C:\Users\c_kazum\pip\pip.log
------------------------------------------------------------
C:\Users\c_kazum\AppData\Local\Continuum\Anaconda\Scripts\pip-script.py run on 08/27/15 12:52:30
Downloading/unpacking xgboost
Getting page https://pypi.python.org/simple/xgboost/
URLs to search for versions for xgboost:
* https://pypi.python.org/simple/xgboost/
Analyzing links from page …Run Code Online (Sandbox Code Playgroud) 中国平安在
r1-r4-r2道路工程,并使用10.0.1.*或10.0.2.*IP地址,但如果我们改变路径,以失败r1-r3-r2使用1.0.0.*或1.0.1.*IP地址完全相同的数据包(除了一个事实,即包src和dstIP字段从改变10.*到1.*,反之亦然,在s1和s2分别).为什么?
我有一个小拓扑如下
h1 -- s1 -- r1 -- r4 -- r2 -- s2 -- h2
\ /
\ /
\ /
r3
Run Code Online (Sandbox Code Playgroud)
这s是OpenvSwitch实例,而rUbuntu 16 Linux机器.
IP地址是:
h1-eth0 - 10.0.1.10/24
s1 - 10.0.1.50/24
h2-eth0 - 10.0.2.10/24
s2 - 10.0.2.50/24
r1-eth0 - 10.0.1.1/24
r1-eth1 - 10.0.11.2/24
r1-eth2 - 10.0.12.2/24
r2-eth0 - 10.0.2.1/24 …Run Code Online (Sandbox Code Playgroud) 我使用了这里提到的布局:jQueryUI布局
我需要将div从左窗格拖到中央窗格.对于跨窗格可拖动性,我使用了以下辅助函数:
function () {
return $(this).clone().appendTo('body').css('z-index',9999).show();
}
Run Code Online (Sandbox Code Playgroud)
但是我想使用greedy: true,如果我使用上面提到的辅助函数,这是行不通的.
如果我使用helper: "clone"然后greedy工作,但跨窗格可拖动性不.
PS:被拖动的div是一般的div(不是手风琴或任何东西)
编辑:演示在https://dl.dropboxusercontent.com/u/140900310/Graphical-IDE-for-C-master/index.html
我现在评论了辅助函数,如果我取消注释然后跨窗格可拖动工作,但贪婪属性没有.
我正在尝试在数据集上训练 xgboost 模型X-train, X_test。代码:
xgb_params = {
"objective": "multi:softmax",
"eta": 0.3,
"num_class": 62,
"max_depth": 10,
"nthread": 4,
"eval_metric": "merror",
"print.every.n": 1
#"silent": 1
}
num_rounds = 2
mask = np.random.choice([False, True], len(X_train), p=[0.75, 0.25])
not_mask = [not i for i in mask]
dtrain = xgb.DMatrix(X_train[not_mask], label=y[not_mask])
dtrain_watch = xgb.DMatrix(X_train[mask], label=y[mask])
dtest = xgb.DMatrix(X_test)
gbdt = xgb.train(xgb_params, dtrain, num_rounds, dtrain_watch)
preds = gbdt.predict(dtest)
Run Code Online (Sandbox Code Playgroud)
但我收到错误:TypeError: 'DMatrix' object is not iterable在倒数第二行。
需要做什么?
编辑:如果我np.array故意打字,我得到TypeError: iteration over a …
我正在尝试使用xgboost(),但我收到以下错误:
Error in xgb.DMatrix(data, label = label) : can not open file "0"
If I traceback,
traceback()
4: .Call("XGDMatrixCreateFromFile_R", data, as.integer(FALSE), PACKAGE = "xgboost")
3: xgb.DMatrix(data, label = label)
2: xgb.get.DMatrix(data, label)
1: xgboost(data = as.matrix(trainSet[, 1:13]), label = trainSet[,
"count"], max.depth = depth, nround = rounds, objective = "reg:linear",
verbose = 0) at #5
Run Code Online (Sandbox Code Playgroud)
我得到上述错误的任何原因.我将不胜感激任何帮助.
提前致谢!
我创建了一个包含两列的 csv 文件,第一列是时间数据,第二列是一些测量数据值。
2015/1/1 0:00 5
2015/1/1 0:15 10
2015/1/1 0:30 10
2015/1/1 0:45 15
2015/1/1 1:00 5
2015/1/1 1:15 20
2015/1/1 1:30 20
2015/1/1 1:45 40
2015/1/1 2:00 30
2015/1/1 2:15 20
2015/1/1 2:30 25
2015/1/1 2:45 10
2015/1/1 3:00
2015/1/1 3:15
2015/1/1 3:30
2015/1/1 3:45
2015/1/1 4:00
2015/1/1 4:15
2015/1/1 4:30 30
2015/1/1 4:45 50
2015/1/1 5:00 70
Run Code Online (Sandbox Code Playgroud)
现在我想使用numpy.loadtxt函数将这两列读入两个不同的 numpy 数组,其中日期列为字符串数据类型,值列为整数数据类型。
我尝试了不同的语句来做到这一点,但它们都不起作用。
time, data = np.loadtxt('TS.csv',dtype=str,delimiter=',',usecols=(0, 1),unpack=True)
time, data = np.loadtxt('TS.csv',dtype=(str,int),delimiter=',',usecols=(0, 1),unpack=True)
time, data = np.loadtxt('TS.csv',dtype=[str,int],delimiter=',',usecols=(0, …Run Code Online (Sandbox Code Playgroud) 我是新手.为什么这段代码不起作用?我想让鸟儿飞翔.
我的HTML:
<img src="http://dl.dropboxusercontent.com/u/105046436/tw.png" />
<br>
<div class="twitter-bird"></div>
Run Code Online (Sandbox Code Playgroud)
我的CSS:
.twitter-bird {
background-image: url(http://dl.dropboxusercontent.com/u/105046436/tw.png);
display: inline-block;
height: 38px;
width: 37.5px;
}
.twitter-bird:hover {
animation: fly 0.2s steps(3) 0 infinite;
}
@keyframes fly {
from { background-position: 0 0; }
to { background-position: -112.5px 0; }
}
Run Code Online (Sandbox Code Playgroud)
JSFiddle:http://jsfiddle.net/6qHMG/
我想要的是:
我想改变图像的背景位置.
怎么了:
悬停时图像位置不会改变.
编辑:我认为背景图像位置没有正确改变.背景位置似乎没有改变.如何设置background-position:的@keyframes fly?
我可以使用此函数从数组中删除所有重复项:
function make_unique(array) {
return array.reduce(function(p, c) {
if (p.indexOf(c) < 0) p.push(c);
return p;
}, []);
};
Run Code Online (Sandbox Code Playgroud)
但这给了我任何2个重复的较低索引元素.我需要一种方法来返回数组中重复的任何元素的"更高"索引副本.
所以在以下数组中:
array = ["bob", "chris", "susan", "steve", "melissa", "steve", "bob"]
Run Code Online (Sandbox Code Playgroud)
它会给我元素1(克里斯),2(苏珊),4(梅利莎),5(史蒂夫),6(鲍勃)
drracket 中是否有用于 label、goto、jump 命令的包?
该控制程序包提供了以下错误:
(let ([x 1])
(let/ec return
(begin/goto
(label l1)
(set! x (+ x 1))
(when (= x 10000000)
(return x))
(goto l1)
2)))
Run Code Online (Sandbox Code Playgroud)
转到:未定义;
不能引用未定义的标识符
需要模拟标签、转到/跳转以在 LLVM IR 中运行代码,因此使用循环重写不是一种选择。