小编Bra*_*man的帖子

当我尝试安装spaCy英语语言模型时,我得到CERTIFICATE_VERIFY_FAILED

我通过Anaconda在Python 3.5.2上运行OS X El Capitan并且拥有spaCy 0.101.0.

我正在尝试使用安装spaCy英语语言模型python -m spacy.en.download.但是,当我这样做时,我得到一个错误urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)>.完整的Traceback如下:

Traceback (most recent call last):
  File "/Users/bsherman/anaconda/lib/python3.5/urllib/request.py", line 1254, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 1151, in _send_request
    self.endheaders(body)
  File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 1102, in endheaders
    self._send_output(message_body)
  File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/Users/bsherman/anaconda/lib/python3.5/http/client.py", line 1260, in connect …
Run Code Online (Sandbox Code Playgroud)

python spacy

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

如何在Shiny中获得一个按钮来同时调用JavaScript和R代码?

我在Shiny中有一个HTML按钮,当单击时,调用目录geocodeAddressStreet(...)中的.js文件中的JavaScript函数/www:

tags$body(tags$input(type = "button", 
                     value = "Next", 
                     id = "button1", 
                     onClick = "geocodeAddressStreet(houseNumber,streetName,addressCity,addressState)"))),
Run Code Online (Sandbox Code Playgroud)

但是,当我点击时,我无法弄清楚如何让这个按钮调用第二个文件foo.R.这两个过程都是独立运行的,但似乎没有办法inputId在Shiny中添加一个HTML元素.我们目前有两个不同的按钮,其中一个调用R代码,另一个调用JavaScript代码,但这显然是一个不切实际的解决方案.

javascript r shiny

7
推荐指数
1
解决办法
2503
查看次数

如何在Python 3中的dateutil解析器中解析超过24小时的日期?

我目前在一个类似"27:32:18"的专栏中有很多次,这意味着有人在等待27小时,32分钟和18秒.每当我尝试解析这些值时,我一直得到"ValueError:小时必须在0..23".

我该如何解析这些值或将它们转换为更标准的格式?我尝试了以下作为单个值的测试:

time1 = "56:42:12"
time2 = time1.split(':')
time2 = [int(n) for n in time2]
time2.insert(0, time2[0] // 24)
time2[1] %= 24
Run Code Online (Sandbox Code Playgroud)

此时,time2是由[2,8,22,12]组成的列表,相当于2天,8小时,42分钟和12秒.我将如何以一种允许Python解析它的方式将其转换为日期,小时,分钟和秒的Python日期时间表示?请注意,我最终将对这些表示等待时间的时间值进行无监督聚类.

python datetime parsing python-3.x

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

通过滚动对象将多个滚动函数应用于pandas组的多个列?

我希望做到以下几点:

  1. 对数据帧进行分组

  2. 对于每个组,生成时间窗口(给定时间单位)

  3. 在结果结构中,获取每列并应用多个滚动摘要统计函数,以便结果具有每个组/时间窗组合的摘要统计.

这是一个示例数据集:

gps_time,name,val_x,val_y
2017-07-04 11:20:23.423,bob,0.963,0.201
2017-07-04 11:20:24.492,bob,0.964,0.203
2017-07-04 11:20:24.499,bob,0.962,0.210
2017-07-04 11:20:25.627,sarah,0.893,0.010
2017-07-04 11:20:28.627,sarah,0.894,0.012
2017-07-04 11:20:29.613,sarah,0.895,0.014
2017-07-04 11:20:29.630,larry,-0.423,0.231
2017-07-04 11:20:30.423,larry,-0.431,0.22
2017-07-04 11:20:30.428,larry,-0.432,0.222
Run Code Online (Sandbox Code Playgroud)

以及上述数据的所需输出,按名称分组,窗口为1秒:

name,gps_time,val_x_mean,val_x_med,val_y_mean,val_y_med
bob,2017-07-04 11:20:23.423,0.963,0.963,0.201,0.201
bob,2017-07-04 11:20:24.492,0.963,0.963,0.2065,0.2065
sarah,2017-07-04 11:20:25.627,0.893,0.89,0.010,0.010
sarah,2017-07-04 11:20:28.627,0.8945,0.8945,0.013,0.013
larry,2017-07-04 11:20:30.423,-0.4287,-0.431,0.336,0.222
Run Code Online (Sandbox Code Playgroud)

我已经尝试使用列表推导来生成一堆数据帧,但是这个过程非常慢,我必须为每一列调用它.

python pandas pandas-groupby

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

标签 统计

python ×3

datetime ×1

javascript ×1

pandas ×1

pandas-groupby ×1

parsing ×1

python-3.x ×1

r ×1

shiny ×1

spacy ×1