[英]Read csv to sframe in google colab
我已經在google-colaboratory上創建了一個新的python 2筆記本,並安裝了sframe(!pip install sframe),但是無法讀取sframe中的CSV文件。 有什么幫助嗎?
要在SFrame中讀取CSV文件,您需要下載turicreate模塊或GraphLab create模塊。
首先,您需要將數據導入到colab中。 因此,您需要了解如何訪問文件:本地存儲或Google驅動器。 您可以使用此鏈接來實現此目的:將數據導入Google Colaboratory 。
要在google-colaboratory中下載turicreate模塊,請執行以下步驟:
1)在colab中使用pip安裝turicreate模塊。
!pip install turicreate
2)導入turicreate模塊。
import turicreate
3)使用turicreate.SFrame.read_csv函數將CSV文件導入到sframe中。 假設CSV文件的內容存儲為'file.csv',而SFrame的名稱為'sf' ,請使用下面的代碼將CSV數據讀取到SFrame中。
sf = turicreate.SFrame.read_csv('file.csv')
而已 !!! 您也可以使用Graphlab create進行相同的操作。
請參閱此處的API文檔:
https://turi.com/products/create/docs/generated/graphlab.SFrame.read_csv.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.