我有一个带有日期时间索引的数据框:
time count day hour minute label
2018-06-07 00:25:00 207 7.0 0.0 25.0 177.0
2018-06-07 00:55:00 187 7.0 0.0 55.0 150.0
2018-06-07 01:25:00 194 7.0 1.0 25.0 165.0
2018-06-07 01:55:00 176 7.0 1.0 55.0 175.0
2018-06-07 02:25:00 195 7.0 2.0 25.0 172.0
-> add new datetime record record here
Run Code Online (Sandbox Code Playgroud)
并且我尝试添加一些新记录,但得到:
[DatetimeIndex(['2018-06-07 01:55:00'], dtype='datetime64[ns]', name='time', freq=None)] not an index
# this happen even if row exists or not
Run Code Online (Sandbox Code Playgroud)
我只想添加一个30分钟的间隔记录,我的代码是这样的
last_date = recent_posts.iloc[[-1]].index
last_date = last_date + timedelta(minutes=30)
recent_posts.iloc[[last_date]] = # bla …
Run Code Online (Sandbox Code Playgroud) 我想将Flask-SocketIO与我的Flask项目集成。我的应用程序在 Nginx 反向代理后面运行:
location /plivo_api{
rewrite ^/plivo_api(.*) /$1 break;
proxy_pass http://127.0.0.1:8090;
}
Run Code Online (Sandbox Code Playgroud)
所以我不明白/plivo_api 中收到的所有流量都将被重写为“/”端口8090。这部分工作得很好。
当我想连接到套接字时,问题就开始了。直接连接到socket没有问题。
# all those examples work
# from localhost
var socket = io.connect()
var socket = io.connect('http://localhost:8090/')
# running the app out of the reverse proxy
var socket = io.connect('http://my_server:8090/')
Run Code Online (Sandbox Code Playgroud)
但是通过 Nginx 我无法连接
# Bad Gateway
var socket = io.connect('http://my_server/plivo_api')
Run Code Online (Sandbox Code Playgroud)
问题是我是否缺少连接到我的 socketio 应用程序的东西,或者还有一些额外的东西要添加到 Nginx 配置中?
与 socketio 集成的烧瓶应用程序代码看起来像
# this code work well, …
Run Code Online (Sandbox Code Playgroud)