擅长:python、mysql、java
<p>熊猫似乎无法直接从URL读取(可能是服务器问题,服务器切断连接,熊猫无法重新连接)</p>
<p>一种解决方案是通过<code>requests</code>读取源代码,然后将其放入:</p>
<pre><code>import requests
import pandas as pd
from io import StringIO
url = "https://api.coronavirus.data.gov.uk/v2/data?areaType=msoa&metric=newCasesBySpecimenDateRollingSum&format=csv"
data = StringIO(requests.get(url).text)
mosa_df = pd.read_csv(data)
print(mosa_df.shape)
</code></pre>
<p>印刷品:</p>
<pre><code>(210785, 11)
</code></pre>