Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 将数据从url加载到数据帧_Python 3.x_Pandas_Url - Fatal编程技术网

Python 3.x 将数据从url加载到数据帧

Python 3.x 将数据从url加载到数据帧,python-3.x,pandas,url,Python 3.x,Pandas,Url,我正在编写pandas教程,希望将以下数据加载到数据帧(我使用的是python 3.6和pandas 0.23.0): 我知道如何从标准数据格式(csv、excel等)加载数据,但现在知道如何处理手头的数据。(可能有一个简单的解决方案(可能已经有了?),但到目前为止,我还没有找到,因为我甚至不知道我到底在看什么) 简单使用,使用url链接到数据非常好: url = 'https://raw.githubusercontent.com/justmarkham/DAT8/master/data/u

我正在编写pandas教程,希望将以下数据加载到数据帧(我使用的是python 3.6和pandas 0.23.0):

我知道如何从标准数据格式(csv、excel等)加载数据,但现在知道如何处理手头的数据。(可能有一个简单的解决方案(可能已经有了?),但到目前为止,我还没有找到,因为我甚至不知道我到底在看什么)

简单使用,使用url链接到数据非常好:

url = 'https://raw.githubusercontent.com/justmarkham/DAT8/master/data/u.user'
df = pd.read_csv(url, sep='|')
print (df.head())
   user_id  age gender  occupation zip_code
0        1   24      M  technician    85711
1        2   53      F       other    94043
2        3   23      M      writer    32067
3        4   24      M  technician    43537
4        5   33      F       other    15213
你试过这个吗

df = pd.read_csv('https://raw.githubusercontent.com/justmarkham/DAT8/master/data/u.user',sep ='|')

谢谢,这正是我想要的!非常感谢你,我感谢你的迅速、友好的回归!