我正在尝试从我从网站上抓取的一些数据中制作一个Pandas DataFrame,并且多次使用find_all,但是有一种方法可以制作多个find_all语句并将结果分成一个pandas Dataframe。更一般而言,我可以使用更少的代码行来创建数据框吗?这是数据帧中包含我当前代码的示例:
96 | AGI | $ 0.03 | $ 1.92 | 4.61%
'''python
cryptoCompareDataFrame = pd.DataFrame({'Name':[item.text.strip() for item in cryptoCompareSoup.find_all('span',{'class':'mobile-name ng- binding'})],
'Price':[item.text.strip() for item in cryptoCompareSoup.find_all('div', {'class':['current-price-value ng-binding','current-price-value ng-binding highlight-down value-down','current-price-value ng-binding highlight-up value-up']})],
'Volume':[item.text.strip() for item in cryptoCompareSoup.find_all('td',{'class':'full-volume col-selected'})],
'24HrDelta':[item.findChild('span').text.strip() for item in cryptoCompareSoup.find_all('td',{'ng-class':["{'col-selected':tableColumns[6].sortApplied}"]})]
})
'''