title: Unable to infer schema for CSV in pyspark
body: <p>I'm using databricks and trying to read in a csv file like this:</p>
  
  <pre><code>df = (spark.read      
    .option("header", "true")
    .option("inferSchema", "true")
    .csv(path_to_my_file)
  )
  </code></pre>
  
  <p>and I'm getting the error: </p>
  
  <pre><code>AnalysisException: 'Unable to infer schema for CSV. It must be specified manually.;'
  </code></pre>
  
  <p>I've checked that my file is not empty, and I've also tried to specify schema myself like this:</p>
  
  <pre><code>schema = "datetime timestamp, id STRING, zone_id STRING, name INT, time INT, a INT"
  df = (spark.read      
    .option("header", "true")
    .schema(schema)
    .csv(path_to_my_file)
  )
  </code></pre>
  
  <p>But when try to see it using display(df), it just gives me this below, I'm totally lost and don't know what to do.</p>
  
  <p><code>df.show() and df.printSchema()</code> gives the following:
  <a href="https://i.stack.imgur.com/gNqBf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gNqBf.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/keeU8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/keeU8.png" alt="enter image description here"></a></p>
  
  <p>It looks like that data are not being read into the dataframe.</p>
  
  <p>error snapshot:
  <a href="https://i.stack.imgur.com/Rsqk5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rsqk5.png" alt="enter image description here"></a></p>