0
私はpythonを使用してWebページを読み込み、csv形式でデータをpandasデータフレームとしてインポートしようとしています。特定のWebページから特定の列を抽出します
私はすべてのページからリンクを抽出する代わりに、特定の列フィールドを読み込もうとしています。
for i in range(10):
url='https://pythonexpress.in/workshop/'+str(i).zfill(3)
import urllib2
from bs4 import BeautifulSoup
try:
page = urllib2.urlopen(url).read()
soup = BeautifulSoup(page)
for anchor in soup.find_all('div', {'class':'col-xs-8'})[:9]:
print i, anchor.text
except:
pass
これらの9列をpandasデータフレームとして保存できますか?
df.columns=['Organiser', 'Instructors', 'Date', 'Venue', 'Level', 'participants', 'Section', 'Status', 'Description']
結果から関心のある列をサブ選択することはできませんか?例えば'df = df [cols_I want]' – EdChum