尝试按照以太坊的wiki示例创建基本合同:https: //github.com/ethereum/go-ethereum/wiki/Contracts-and-Transactions
一切似乎都有效,直到我下到最后一行:
source = "contract test { function multiply(uint a) returns(uint d) { return a * 7; } }"
contract = eth.compile.solidity(source).test
primaryAddress = eth.accounts[0]
# **Problems start here **
MyContract = eth.contract(abi);
contact = MyContract.new(arg1, arg2, ...,{from: primaryAddress, data: evmCode})
Run Code Online (Sandbox Code Playgroud)
eth.contract方法的"abi"参数是什么?另外,我会在"evmCode"参数中加入什么?在这个特定的例子中,似乎我会为"arg1"输入一个整数,但不确定完整的例子应该是什么样子.
我正在尝试进行无法解决的数据帧转换.我尝试过stackoverflow和pandas文档的多种方法:apply,apply(lambda:...),pivot和join.在这里列出太多的尝试,但不确定哪种方法是最好的,或者我是否尝试使用错误语法的正确方法.
基本上,我有一个数据帧,我需要1)偏移列,2)偏移的列数变化并取决于数据帧中的变量,3)在数据帧的末尾创建需要容纳的列偏移量,4)在新创建的间隔中放置零.
df1 = pd.DataFrame({'first' : ['John', 'Mary', 'Larry', 'jerry'], '1' : [5.5, 6.0,10,20], '2' : [100, 200, 300, 400], '3' : [150, 100, 240, 110], 'offset' : ([1,0,2,1])})
goal_df = pd.DataFrame({'first' : ['John', 'Mary', 'Larry', 'jerry'], '1' : [0.0, 6.0, 0.0, 0], '2' : [5.5, 200, 0.0, 20], '3' : [100, 100, 10, 400], '4' : [150, 0.0, 300, 110], '5' : [0.0, 0.0, 240, 0.0]})
df1
1 2 3 first offset
5.5 100 150 John 1
6.0 200 …Run Code Online (Sandbox Code Playgroud)