title: How can I create columns from rows in a pandas dataframe (Python 3.7)?
body: <p>I would like to restructure a pandas dataframe from long to wide according to the data in the dataframe rows. I have a pandas dataframe of the following form:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>item_type</th>
  <th>item_content</th>
  <th>meet_mins_content</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>THE BOARD OF EDUCATION \nOF THE</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>LONG BEACH UNIFIED SCHOOL DISTRICT \n \n...</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>\nA regular meeting of the Board ...</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>Present: Members Craighead, Kerr, ...</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>Call to \nOrder \n</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>President Kerr called the meeting to ...</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>Closed \nSession \n</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>President Kerr announced that the Boar...</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>Call to \nOrder</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>Having completed the Closed Session, P...</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>Report of \nClosed \nSession \n</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>President Kerr reported that the Gover...</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>Public \nHearing \n \nRes. 071618-C, \nDe...</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>President Kerr announced the public he...</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>Call for \nAgenda \nItems/ \nAdopt \n...</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>President Kerr asked if Board Members ...</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>Approval \n of \nMinutes</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>It was moved by Member Meyer that th...</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>Communi-\ncations \n</td>
  </tr>
  <tr>
  <td>NaN</td>
  <td>NaN</td>
  <td>Member Craighead recognized Mary Pallad...</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>From the dataframe preview above, I would like certain values of <code>meet_mins_content</code> to instead serve as values for <code>item_type</code> with the row immediately below serving as the value for <code>item_content</code>. I know the list of the values that I would like to go into <code>item_type</code>: &quot;Call to \nOrder \n&quot;, &quot;Closed \nSession \n&quot;, &quot;Call to \nOrder&quot;, &quot;Report of \Closed Session \n&quot;, and &quot;Approval \n of \nMinutes&quot;. For each of these, the row immediately below should populate the corresponding cell for <code>item_content</code> -- for example, the first row in my dataframe should be <code>item_type</code> == &quot;Call to \nOrder \n&quot; and <code>item_content</code>. It is OK to keep <code>meet_mins_content</code> for now, though I would eventually like to delete it.</p>
  <p>Here is the kind of dataframe that I am looking for:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>item_type</th>
  <th>item_content</th>
  <th>meet_mins_content</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Call to \nOrder \n</td>
  <td>President Kerr called the meeting to ...</td>
  <td>THE BOARD OF EDUCATION \nOF THE</td>
  </tr>
  <tr>
  <td>Closed \nSession \n</td>
  <td>President Kerr announced that the Boar...</td>
  <td>Closed \nSession \n</td>
  </tr>
  <tr>
  <td>Purchasing \n&amp; Contract \nReport</td>
  <td>Member Meyer moved approval of the Pu...</td>
  <td>Closed \nSession \n</td>
  </tr>
  <tr>
  <td>Citizens' Bond \nOversight \nComte. \n</td>
  <td>Member Williams moved Approval of Memb...</td>
  <td>Closed \nSession \n</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Is there a way to pass a list of values that can accomplish the task I have outlined? Happy to share more code about where this data came from (a parsed PDF).</p>