title: How to add values to columns if field is NaN upon split()
body: <p>How to set the values of fields to NaN using Pandas.</p>
  
  <p>I have a spreadsheet file as an input and one of the columns has empty values which I filled with NaN values.</p>
  
  <p>I am trying to split the first name with the suffix. I did use str.split().
  But since there are NaN-value fields.</p>
  
  <p>I encountered this error. </p>
  
  <blockquote>
    <p>ValueError: Columns must be same length as key</p>
  </blockquote>
  
  <p>This is my sample DataFrame.</p>
  
  <blockquote>
    <p>input_data = {
    ["John III","Snow"],["",""],["John","Snow"]}</p>
  </blockquote>
  
  <p>This is my expected output</p>
  
  <blockquote>
    <p>expected_output = {["John","Snow","III"],["","",""],["John","Snow",""]}</p>
  </blockquote>
  
  <p>This is my sample code</p>
  
  <pre><code>df[[fname[0][0],fname[1][0]]] = df[column].str.split('&amp;', expand=True, n=1)
  df.applymap(lambda x: x.strip() if type(x) is str else x)
  df.fillna(value=pd.np.nan, inplace=True)
  df[[fname[0][0],fname[0][2]]] = df[fname[0][0]].str.split('\s+(?=Jr|Sr|JR|SR|II|III|IV)', expand=True, n=1)
  </code></pre>
  
  <p>I am just a newbie in Pandas and Numpy.</p>