title: Append dataframes with different column names - Pandas
body: <p>I have 3 dataframes which can be generated from the code shown below</p>
  
  <pre><code>df1= pd.DataFrame({'person_id':[1,2,3],'gender': ['Male','Female','Not disclosed'],'ethn': ['Chinese','Indian','European']})
  df2= pd.DataFrame({'pers_id':[4,5,6],'gen': ['Male','Female','Not disclosed'],'ethnicity': ['Chinese','Indian','European']})
  df3= pd.DataFrame({'son_id':[7,8,9],'sex': ['Male','Female','Not disclosed'],'ethnici': ['Chinese','Indian','European']})
  </code></pre>
  
  <p>I would like to do two things</p>
  
  <p>a) <strong>Append all these 3 dataframes into one large <code>result</code> dataframe</strong></p>
  
  <p>When I attempted this using the below code, the output isn't as expected</p>
  
  <pre><code>df1.append(df2)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ZwQqC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZwQqC.png" alt="enter image description here"></a></p>
  
  <p>So, to resolve this, I understand we have to rename the column names which leads to objective b below</p>
  
  <p>b) <strong>Rename the column of these n dataframes to be uniform in a elegant way</strong></p>
  
  <p>Please note that in real time I might have dataframe with different column names which I may not know in advance but the values in them will always be the same belonging to columns <code>Ethnicity</code>, <code>Gender</code> and <code>Person_id</code>. But note there can be several other columns as well like <code>Age</code>, <code>Date</code>,<code>bp reading</code> etc</p>
  
  <p>Currently, I do this by manually reading the column names using below code</p>
  
  <pre><code>df2.columns
  df2.rename(columns={ethnicity:'ethn',gender = 'gen',person_id='pers_id}, 
               inplace=True)
  </code></pre>
  
  <p>How can I set the column names for all dataframe to be the same (<code>gender</code>,<code>ethnicity</code>,<code>person_id</code> and etc) irrespective of their original column values</p>