title: How to split a DataFrame column value on linefeed and create a new column with the last 2 items (lines)
body: <p>I'd like to split a column value with line feeds and create a new column with the two last items (lines)</p>
  <pre><code>df1 = spark.createDataFrame([
    [&quot;001\r\nLuc  Krier\r\n2363  Ryan Road, Long Lake South Dakota&quot;],
    [&quot;002\r\nJeanny  Thorn\r\n2263 Patton Lane Raleigh North Carolina&quot;],
    [&quot;003\r\nTeddy E Beecher\r\n2839 Hartland Avenue Fond Du Lac Wisconsin&quot;],
    [&quot;004\r\nPhilippe  Schauss\r\n1 Im Oberdorf Allemagne&quot;],
   [&quot;005\r\nMeindert I Tholen\r\nHagedoornweg 138 Amsterdam&quot;]
  ]).toDF(&quot;s&quot;)
  </code></pre>
  <p>This is not working (None value):</p>
  <pre><code>df.withColumn('last_2', split(df.s, '\r\n')[-2]) 
  </code></pre>