title: Pandas Split Function in Reverse
body: <p>I have a Pandas Dataframe with a column that looks like this:</p>
  
  <pre><code>    Car_Make
  0   2017 Abarth 124 Spider ManualConvertible
  1   2017 Abarth 124 Spider AutoConvertible
  2   2017 Abarth 124 Spider ManualConvertible
  3   2017 Abarth 124 Spider AutoConvertible
  4   2017 Abarth 595 ManualHatch
  5   2017 Abarth 595 AutoHatch
  </code></pre>
  
  <p>Three Questions:</p>
  
  <p>1 <a href="https://stackoverflow.com/questions/40069551/how-to-save-split-data-in-panda-in-reverse-order/40069615#40069615">How to save split data in panda in reverse order?</a> - This solves my problem but I don't know how or why it works - can someone please explain this to me? I hate copy pasting without understanding why it works</p>
  
  <pre><code>df['Car_Make'].apply(lambda x:pd.Series(x.split()[::-1])) 
  </code></pre>
  
  <p>2 I have tried to replicate it using a user-defined function (that I can use again) with the following, but it doesn't appear to work (any help understanding why and the correct way to turn the Lambda function into a user-defined function</p>
  
  <pre><code>def f(x):
      df[x] = pd.Series(x.split()[::-1])
      return df
  </code></pre>
  
  <p>3 Is there a better way to split this column by space in reverse?</p>
  
  <p>I have tried using Regex which works, but not on all rows as you can see row 4 and 5 a slightly different to the above.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thanks,
  Adrian</p>