我有以下带有时间戳索引的数据帧结构:
neg neu norm pol pos date
time
1520353341 0.000 1.000 0.0000 0.000000 0.000
1520353342 0.121 0.879 -0.2960 0.347851 0.000
1520353342 0.217 0.783 -0.6124 0.465833 0.000
Run Code Online (Sandbox Code Playgroud)
我从时间戳创建日期:
data_frame['date'] = [datetime.datetime.fromtimestamp(d) for d in data_frame.time]
Run Code Online (Sandbox Code Playgroud)
结果:
neg neu norm pol pos date
time
1520353341 0.000 1.000 0.0000 0.000000 0.000 2018-03-06 10:22:21
1520353342 0.121 0.879 -0.2960 0.347851 0.000 2018-03-06 10:22:22
1520353342 0.217 0.783 -0.6124 0.465833 0.000 2018-03-06 10:22:22
Run Code Online (Sandbox Code Playgroud)
我想按小时分组,同时获取除timestamp以外的所有值的均值,该值应该是分组开始的小时。所以这是我要存档的结果:
neg neu norm pol …Run Code Online (Sandbox Code Playgroud) 我正在尝试personal_sign在 Golang 中生成一个像在 ethers.js 中实现的那样。类似的问题,但最终使用常规sign而不是个人sign_implementation。
醚类
// keccak256 hash of the data
let dataHash = ethers.utils.keccak256(
ethers.utils.toUtf8Bytes(JSON.stringify(dataToSign))
);
//0x8d218fc37d2fd952b2d115046b786b787e44d105cccf156882a2e74ad993ee13
let signature = await wallet.signMessage(dataHash); // 0x469b07327fc41a2d85b7e69bcf4a9184098835c47cc7575375e3a306c3718ae35702af84f3a62aafeb8aab6a455d761274263d79e7fc99fbedfeaf759d8dc9361c
Run Code Online (Sandbox Code Playgroud)
戈兰:
func signHash(data []byte) common.Hash {
msg := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), data)
return crypto.Keccak256Hash([]byte(msg))
}
privateKey, err := crypto.HexToECDSA(hexPrivateKey)
if err != nil {
log.Fatal(err)
}
dataHash := crypto.Keccak256Hash(dataToSign) //0x8d218fc37d2fd952b2d115046b786b787e44d105cccf156882a2e74ad993ee13
signHash := signHash(dataHash.Bytes())
signatureBytes, err := crypto.Sign(signHash.Bytes(), privateKey)
if err != nil {
log.Fatal(err)
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的Angular应用程序中使用模态。我尝试使用Bootstrap和Angular Material模态,但无法使其正常工作。我决定尝试使用Angular Modal Service,但是遇到了同样的错误。每当我调用函数ModalService.showModal时,都会出现以下错误:
angular.js:12416 TypeError: Cannot read property 'showModal' of undefined
at Scope.$scope.show (AboutController.js:4)
at fn (eval at <anonymous> (angular.js:13231), <anonymous>:4:203)
at callback (angular.js:23371)
at Scope.$eval (angular.js:15878)
at Scope.$apply (angular.js:15978)
at HTMLAnchorElement.<anonymous> (angular.js:23376)
at HTMLAnchorElement.n.event.dispatch (jquery-2.2.3.min.js:3)
at HTMLAnchorElement.r.handle (jquery-2.2.3.min.js:3)
Run Code Online (Sandbox Code Playgroud)
我使用的服务是:
https://github.com/dwmkerr/angular-modal-service
Run Code Online (Sandbox Code Playgroud)
我使用的JS Fiddle示例:
http://jsfiddle.net/dwmkerr/8MVLJ/?utm_source=website&utm_medium=embed&utm_campaign=8MVLJ
Run Code Online (Sandbox Code Playgroud)
包括:
<!-- Include jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<!-- Include Bootstrap -->
<script src="../node_modules/bootstrap/js/bootstrap.js"></script>
<!-- Include Angular -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.js"></script>
<!-- Include ModalService-->
<script src="../node_modules/angular-modal-service/dst/angular-modal-service.min.js"></script>
Run Code Online (Sandbox Code Playgroud)
About.html:
<div class="container">
<div class="col-sm-6 col-sm-offset-3 form-box">
<h3>Comentarios</h3>
<a class="btn …Run Code Online (Sandbox Code Playgroud) angularjs ×1
cloud9-ide ×1
cryptography ×1
dataframe ×1
ethereum ×1
ethers.js ×1
go ×1
javascript ×1
pandas ×1
python ×1
signature ×1
timestamp ×1