我有一个如下数据框,其中ev是string类型.
>>> df2.show()
+---+--------------+
| id| ev|
+---+--------------+
| 1| 200, 201, 202|
| 1|23, 24, 34, 45|
| 1| null|
| 2| 32|
| 2| null|
+---+--------------+
Run Code Online (Sandbox Code Playgroud)
有没有办法在不使用UDF或UDF的情况下将ev转换为类型ArrayType是唯一的选择呢?
Python版本:3.5.1
请求版本:2.9.1.
我试图在python的请求中获取url的IP地址,如下所示:如何使用请求库从http请求中获取IP地址?
import requests
rsp = requests.get('http://google.com', stream=True)
# grab the IP while you can, before you consume the body!!!!!!!!
print (rsp.raw._fp.fp._sock.getpeername())
# consume the body, which calls the read(), after that fileno is no longer available.
print (rsp.content)
Run Code Online (Sandbox Code Playgroud)
得到以下错误:
AttributeError: '_io.BufferedReader' object has no attribute '_sock'
Run Code Online (Sandbox Code Playgroud)
可能是某些版本问题.请帮忙.
PS无法在原帖中发表评论.