title: How to Change Column Name with a Combination of Other Row's Info?
body: <p><a href="https://i.stack.imgur.com/CU9ui.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CU9ui.png" alt="enter image description here"></a></p>
  
  <p>Every even column has a name of "sales.xxxxxxxx" in my data frame. </p>
  
  <p>I'd like to just read in right before column and this(odd) column only contains one information - 3 unique digit code, such as AAA, AAB...etc.</p>
  
  <p>I'd like to change the name of even column into "AAA.xxxxxxx" just replacing the string "sales".</p>
  
  <p>How could I do this?</p>
  
  <hr>
  
  <p>What I have tried:</p>
  
  <p>first, I had dropped first column(I don't need that)</p>
  
  <pre><code>del df["Unnamed: 0"]
  </code></pre>
  
  <p>Second, I had make each cate_level column into list and just take a string element as a loop statment(but I think it also quite computationally inefficient..it takes too long) And then, concatenate with next column name.</p>
  
  <pre><code>for i in range(1, 6905, 2): #there exist 6905 columns, so loop over every 2 columns
      for k in range(11293): #each column has 11293 rows
          tri_codes = df[str(df.columns[i])].tolist() #check which tri_code that cate column have
          if type(tri_codes[k]) == str: #once catch the string
              column_cat = tri_codes[k]
              break #done, quickly finish the loop
      df.rename(columns={ df.columns[i+1] : column_cat + "."+ df.columns[i+1].split(".")[1]}) #change col name
  </code></pre>
  
  <p>add. What I try to do:
  change every sales.xxxx column_name into tricode.xxxx like following:
  <a href="https://i.stack.imgur.com/DVILJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DVILJ.png" alt="enter image description here"></a></p>