小编Leo*_*Leo的帖子

类中的异步函数

当我尝试运行类中描述的异步函数时,我收到此错误

masterClass.js

class MasterClass{

  async function updateData(a, b){
    let [ res1, res2 ] = await Promise.all(call1, call2);
    return  [ res1, res2 ]
  }

}
Run Code Online (Sandbox Code Playgroud)

test.js

const MasterClass =  require('./MasterClass.js')
let m = new MasterClass()
m.updateData(a, b)
Run Code Online (Sandbox Code Playgroud)

错误

async function updateData(a, b){
                 ^^^^^^^^^^
SyntaxError: Unexpected identifier
Run Code Online (Sandbox Code Playgroud)

javascript node.js

9
推荐指数
1
解决办法
7562
查看次数

Pandas Pivot 重复索引行

如果我将 Pandas 数据透视表导出到 CSV 表,我会得到

first  second   
bar    one     A    0.721555
               B   -0.706771
       two     A   -1.039575
               B    0.271860
baz    one     A   -0.424972
               B    0.567020
       two     A    0.276232
               B   -1.087401
Run Code Online (Sandbox Code Playgroud)

因为我正在 Excel 中处理这些数据,所以我会重复所有行,例如

first  second   
bar    one     A    0.721555
bar    one     B   -0.706771
bar    two     A   -1.039575
bar    two     B    0.271860
baz    one     A   -0.424972
baz    one     B    0.567020
baz    two     A    0.276232
baz    two     B   -1.087401
Run Code Online (Sandbox Code Playgroud)

你知道这怎么可能吗?

python pivot pandas

3
推荐指数
1
解决办法
7935
查看次数

SSL:CERTIFICATE_VERIFY_FAILED 证书验证失败

from lxml import html
import requests


url = "https://website.com/"
page = requests.get(url)
tree = html.fromstring(page.content)
page.content
Run Code Online (Sandbox Code Playgroud)

-> SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败 (_ssl.c:748)

我运行此脚本,但出现此错误。我该怎么做?

python ssl lxml xmlhttprequest python-3.x

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

python ×2

javascript ×1

lxml ×1

node.js ×1

pandas ×1

pivot ×1

python-3.x ×1

ssl ×1

xmlhttprequest ×1