小编dra*_*ram的帖子

Pandas 索引与日期值的差异

如果我有这样的 DataFrame

Date           value
04 May 2015     1
06 May 2015     1
07 May 2015     1
11 May 2015     1
11 May 2015     1
Run Code Online (Sandbox Code Playgroud)

如何获得日期索引的差异?即下面的第三列:

Date           value   Diff
04 May 2015     1      NA
06 May 2015     1       2
07 May 2015     1       1
11 May 2015     1       4
11 May 2015     1       0
Run Code Online (Sandbox Code Playgroud)

python pandas

9
推荐指数
2
解决办法
7102
查看次数

Node js将pdf缓冲区转换回pdf

我已经使用Java的浏览器创建了一个pdf文件,并使用以下代码通过邮政将其发送到服务器:

var blob = pdf.output('blob')
var xhr = new XMLHttpRequest();
xhr.open('post','/upload', true);
xhr.setRequestHeader("Content-Type", "application/pdf");                                
xhr.send(blob);
Run Code Online (Sandbox Code Playgroud)

我想在Express上运行Node的服务器上另存为pdf。我已经使用express和body-parser包提出了以下代码:

const bodyParser = require('body-parser');

app.use(bodyParser.urlencoded({ limit: '1gb', extended: false }));
app.use(bodyParser.raw({ limit: '1gb', type: 'application/pdf' }));

app.post('/upload', function(req, res){
   console.log(req.body);      
}
Run Code Online (Sandbox Code Playgroud)

req.body是一个缓冲区,Uint8Array [653120]:

在将其保存到服务器上之前,我需要帮助将其转换回pdf。任何帮助,将不胜感激。谢谢。

pdf-generation xmlhttprequest node.js express body-parser

5
推荐指数
1
解决办法
6119
查看次数

没有名为'concurrent.futures'的模块; 'concurrent'不是使用Python 3.6.0的包

当我在Mac OSX命令行上的python中执行以下操作时:

>>> from concurrent.futures import ProcessPoolExecutor
Run Code Online (Sandbox Code Playgroud)

我明白了

ModuleNotFoundError: No module named 'concurrent.futures'; 'concurrent' is not a package
Run Code Online (Sandbox Code Playgroud)

python --version使用Virtualenvs给人3.6.0,我已经做了pip3 install asyncio,也pip3 install futures.

python-3.x python-asyncio

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