title: How do I add a column to my dataframe that says what sheet name each row is from? Python
body: <p>I am working with a Dataframe that has five sheets and I want to use four of them. So I can load it in:</p>
  
  <p><code>df = pd.read_excel('***.xls', sheet_name=['a', 'b', 'c', 'd'])</code></p>
  
  <p>But now I would like to add a column that says what sheet each row was in, and I am not sure how to do this. I tried something like this</p>
  
  <pre class="lang-py prettyprint-override"><code>for name, frame in df.items():
          frame['Sheet'] = name
          df = df.append(frame, ignore_index=True)
  </code></pre>
  
  <p>but I was getting the following error: </p>
  
  <blockquote>
    <p>AttributeError: 'collections.OrderedDict' object has no attribute 'append'</p>
  </blockquote>
  
  <p>Any help would be greatly appreciated. Thank you in advance! </p>
  
  <p>Let's say this is what my data looks like after I concat the sheets:</p>
  
  <pre class="lang-py prettyprint-override"><code>df = pd.concat(pd.read_excel(***.xls, sheet_name=['a', 'b', 'c', 'd'],
                            header=1), ignore_index=True, sort=False)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/BVro6.png" rel="nofollow noreferrer">Concat data</a></p>
  
  <p>My goal is to add a column that says what sheet each row was from, like so...</p>
  
  <p><a href="https://i.stack.imgur.com/Y5FUk.png" rel="nofollow noreferrer">Concat data with sheet name row</a></p>
  
  <p>Hopefully that helps you understand what I am trying to go for. </p>
  
  <p>(Edit) I would also like to know how to do this if I wanted to use all the sheets in a dataframe, but didn't want to list the individual names of each sheet. Thanks! </p>