0

I have created a new notebook of python 2 on google-colaboratory and installed sframe(!pip install sframe) but I'm unable to read the CSV file in sframe. Any help?

Vijay Pandit
  • 1
  • 1
  • 1
  • Did you try anything? Do you have any specific error message? Please provide more details to your question - it will be easier to answer! – Paweł Hemperek Mar 05 '18 at 12:08

1 Answers1

2

To read a CSV file in a SFrame, you need to download either turicreate module or GraphLab create module.

Firstly, you need to import data into colab. So you need to recognize how are you accessing your file: local storage or google drive. You can use this link to achieve this: Import data into Google Colaboratory.

For downloading the turicreate module in google-colaboratory, do the following steps:

1) Install turicreate module using pip in colab.

        !pip install turicreate

2) Import the turicreate module.

        import turicreate

3) Use the turicreate.SFrame.read_csv function to import the CSV file into the sframe. Assume that the content of the CSV file is stored as 'file.csv' and the name of the SFrame is 'sf', use the code below to read the CSV data into a SFrame.

        sf = turicreate.SFrame.read_csv('file.csv')

That's it !!! You can also do the same with Graphlab create.

Refer to the API documentations over here:

https://apple.github.io/turicreate/docs/api/generated/turicreate.SFrame.read_csv.html#turicreate.SFrame.read_csv

https://turi.com/products/create/docs/generated/graphlab.SFrame.read_csv.html