title: Split values and renaming the columns with splitted value in pandas dataframe
body: <p>So now I have a csv and the data look like this</p>
  <pre><code> email='abc@cde.com' AID=100200 PID=2500 NID=3950 
   email='def@ghk.com' AID=357156 PID=3544 NID=2688 
   email='testing@edu.uk' AID=385746 PID=6709 NID=2433
   ....
  </code></pre>
  <p>I want to split this series into a dataframe and the final table shd be as follows:</p>
  <pre><code>     email           AID     PID     NID
     abc@cde.com     100200   2500   3950
     def@ghk.com     357156   3544   2688
     testing@edu.uk  385746   6709   2433
  </code></pre>
  <p>In other words, what I want are as follows:</p>
  <ul>
  <li>First split the series into 4, with the delimiter ' '</li>
  <li>Then further split all the series in the new dataframe with the delimiter '='</li>
  <li>Finally form the table. The first part shd be the column name, and the sceond part shd remain as values</li>
  </ul>
  <p>What I did was:</p>
  <pre><code># Assume the df as newdf 
  import pandas as pd
  
  excel_test = pd.read_csv('filename')
  newdf = excel_test.iloc[:,1].str.split(' ', expand=True)
  
  for x in range(1, len(newdf.columns) -1):
      newdf.iloc[:,x] = newdf.iloc[:,x].str.split('=', expand=True)[1]
      new_column_name = newdf.iloc[:,x].str.split('=', expand=True)[0]
      newdf.rename(columns={newdf.columns[x]: new_column_name}, inplace=True)
  
  print(newdf)
  </code></pre>
  <p>In this script, I got the values, however, I got an error:<br />
  TypeError: 'Series' objects are mutable, thus they cannot be hashed</p>
  <p>When I tried to change the column name as well</p>
  <p>So here comes to the question:</p>
  <ol>
  <li>How can I change the column name at the same time in this case?</li>
  <li>I have a feeling that the for loop can be replaced with sth like str function, in order to make the code more clean and structured. Is there any alternative way to do so?</li>
  </ol>
  <p>Thank you for your help!</p>