在R中,通过该str()函数,您可以看到来自这样的对象的结构:
> str(mari)
'data.frame': 25834 obs. of 6 variables:
$ Xcoor: num 0.0457 0.0469 0.0481 0.0495 0.0519 ...
$ Ycoor: num 0.107 0.107 0.107 0.108 0.108 ...
$ Zcoor: num -0.701 -0.701 -0.701 -0.703 -0.703 ...
$ RC : int 120 124 124 125 124 122 120 120 120 120 ...
$ GC : int 121 117 117 117 118 119 120 120 120 120 ...
$ BC : int 127 135 144 135 126 127 125 125 …Run Code Online (Sandbox Code Playgroud) 我有两个python脚本,一个有我定义的所有函数(functions.py),另一个只运行那些函数(running_functions.py).我使用将函数导入running_functions脚本from functions import*
我的问题是,当我跑running_functions使用到蟒蛇控制台execfile('running_functions.py')在第一工作就像一个魅力,但如果我不关闭蟒蛇会议,并做了一些修改成一个功能functions.py(例如改变该参数的数量getLabels()需要(从4到5))保存然后我再次运行running_functions.py与相同的命令或当我打电话给getLabels()我得到错误:
用execfile()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "running_functions.py", line 82, in <module>
predict_labels = getLabels(pred_labels, ids_tr ,labels_tr,filenames_tr, filenames_ts)
TypeError: getLabels() takes exactly 4 arguments (5 given)
Run Code Online (Sandbox Code Playgroud)
调用函数
>>> predict_labels = getLabels(pred_labels, ids_tr ,labels_tr,filenames_tr, filenames_ts)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: getLabels() takes exactly 4 arguments …Run Code Online (Sandbox Code Playgroud)