title: Python spark extract characters from dataframe
body: <p>I have a dataframe in spark, something like this:</p>
  
  <pre><code>ID     | Column
  ------ | ----
  1      | STRINGOFLETTERS
  2      | SOMEOTHERCHARACTERS
  3      | ANOTHERSTRING
  4      | EXAMPLEEXAMPLE
  </code></pre>
  
  <p>What I would like to do is extract the first 5 characters from the column plus the 8th character and create a new column, something like this:</p>
  
  <pre><code>ID     | New Column
  ------ | ------
  1      | STRIN_F
  2      | SOMEO_E
  3      | ANOTH_S
  4      | EXAMP_E
  </code></pre>
  
  <p>I can't use the following codem, because the values in the columns differ, and I don't want to split on a specific character, but on the 6th character:</p>
  
  <pre><code>import pyspark
  split_col = pyspark.sql.functions.split(DF['column'], ' ')
  newDF = DF.withColumn('new_column', split_col.getItem(0))
  </code></pre>
  
  <p>Thanks all!</p>