我有一些麻煩來讀取這樣的數據集:閱讀CSV與大熊貓有這種數據集
# title
# description
# link (could be not still active)
# id
# date
# source (nyt|us|reuters)
# category
例如:
court agrees to expedite n.f.l.'s appeal\n
the decision means a ruling could be made nearly two months before the regular season begins, time for the sides to work out a deal without delaying the
season.\n
http://feeds1.nytimes.com/~r/nyt/rss/sports/~3/nbjo7ygxwpc/04nfl.html\n
0\n
04 May 2011 07:39:03\n
nyt\n
sport\n
我想:
columns = ['title', 'description', 'link', 'id', 'date', 'source', 'category']
df = pd.read_csv('news', delimiter = "\n", names = columns,error_bad_lines=False)
但它將所有信息放入列標題中。
有人知道一種方法來解決這個問題嗎?
謝謝!