title: How to split a column into 4 columns based on spaces in python?
body: <p>I have seen similar questions, but it seems all would not work in Python 3.8. I have a dataframe like</p>
  <pre><code>index id
  0   0001 01 12537.30 0
  1   0001 01 1278.50 1
  2   0001 03 53.10 0
  </code></pre>
  <p>where id column should be split into 4 columns, but they are in one column now. I need to split it based on space.</p>
  <p>I have tried</p>
  <pre><code>df2 = df1['id'].apply(lambda x: pd.Series(x.split(' ')))
  </code></pre>
  <p>or</p>
  <pre><code>df1[[&quot;City&quot;, &quot;State&quot;, &quot;Country&quot;,'indicator']] = df1[&quot;id&quot;].str.split(pat=&quot; &quot;, expand=True)
  </code></pre>
  <p>All told me that
  TypeError: 'function' object is not subscriptable.
  Does anyone have any idea? Thanks</p>