title: "unbound method textFile() must be called with SparkContext instance as first argument (got str instance instead)"
body: <p>I am trying to use the sc.textFile() function to read a csv file. However I am getting the "unbound method textFile() must be called with SparkContext instance as first argument (got str instance instead)" error. I checked within stackoverflow for possible answers but couldnt find any answers. Please help</p>
  
  <p>I am using the below script in iPython Notebook</p>
  
  <pre><code>import os.path
  
  from pyspark import SparkContext
  
  
  import csv
  
  
  basedir = os.path.join('data') 
  
  inputpath = os.path.join('train_set.csv') 
  
  filename = os.path.join(basedir,inputpath)
  
  numpart = 2
  
  sc = SparkContext
  
  train_data = sc.textFile(filename,numpart)
  </code></pre>
  
  <h3>Just to clarify, basedir ('data') is the folder where the csv file resides. Please help</h3>