做这个练习是为了学习熊猫。我认为根据错误提供的数据库有问题。你知道吗
想法?你知道吗
代码:
import numpy as np
import scipy as sp
import pandas as pd
import matplotlib as mpl
url = 'https://raw.githubusercontent.com/justmarkham/DAT8/master/data/chipotle.tsv'
chipo = pd.read_csv(url, delimiter='/t')
print(chipo.head(10))
输出:
ex22_chipotle.py:7: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
chipo = pd.read_csv(url, delimiter='/t')
order_id\tquantity\titem_name\tchoice_description\titem_price
0 1\t1\tChips and Fresh Tomato Salsa\tNULL\t$2.39
1 1\t1\tIzze\t[Clementine]\t$3.39
2 1\t1\tNantucket Nectar\t[Apple]\t$3.39
3 1\t1\tChips and Tomatillo-Green Chili Salsa\tN...
4 2\t2\tChicken Bowl\t[Tomatillo-Red Chili Salsa...
5 3\t1\tChicken Bowl\t[Fresh Tomato Salsa (Mild)...
6 3\t1\tSide of Chips\tNULL\t$1.69
7 4\t1\tSteak Burrito\t[Tomatillo Red Chili Sals...
8 4\t1\tSteak Soft Tacos\t[Tomatillo Green Chili...
9 5\t1\tSteak Burrito\t[Fresh Tomato Salsa, [Ric...
使用
\t
作为分隔符bytab
:相关问题 更多 >
编程相关推荐