title: split pandas dataframe based on string column value
body: <p>I am struggling with trying to split my dataframe into 3 new dataframes where the split occurs when the supplier name changes. I have searched for existing questions. <a href="https://stackoverflow.com/questions/57989742/how-to-split-dataframe-on-based-on-columns-row">How to split dataframe on based on columns row</a> and <a href="https://stackoverflow.com/questions/48794671/pandas-python-split-dataframe-into-many-dataframes-based-on-column-value-cont">Pandas &amp; python: split dataframe into many dataframes based on column value containing substring</a> came close but I cannot get the output that I want. </p>
  
  <p>Here is attached a toy dataset to illustrate my problem:</p>
  
  <pre><code>df = pd.DataFrame({'Supplier': ['Supplier1', 'Supplier1', 'Supplier2', 'Supplier2', 'Supplier2', 'Supplier3','Supplier3'], 'Class' : ['A', 'A','A','A','A','B','B']})
  </code></pre>
  
  <p>and I tried (unsuccessfully)</p>
  
  <pre><code>df1 = df.iloc[:df.index[df['Supplier'] == 'Supplier1'].tolist()[0]]
  df2 = df.iloc[df.index[df['Supplier'] == 'Supplier2'].tolist()[0]+1:]
  df3 = df.iloc[df.index[df['Supplier'] == 'Supplier3'].tolist()[0]+1:]
  </code></pre>
  
  <p>The result that I am trying to achieve is:</p>
  
  <pre><code>   Supplier Class
  0  Supplier1     A
  1  Supplier1     A
      Supplier Class
  0  Supplier2     A
  1  Supplier2     A
  2  Supplier2     A
      Supplier Class
  0  Supplier3     B
  1  Supplier3     B
  </code></pre>
  
  <p>Any help on this would be greatly appreciated. Thank you! </p>
  
  <p>UPDATE: 
  Using:</p>
  
  <pre><code>df1 = {i:group for i,group in df.groupby( df['Supplier'].ne(df['Supplier'].shift()).cumsum() )}
  </code></pre>
  
  <p>gives:</p>
  
  <pre><code>{1:     Supplier Class
  0  Supplier1     A
  1  Supplier1     A, 2:     Supplier Class
  2  Supplier2     A
  3  Supplier2     A
  4  Supplier2     A, 3:     Supplier Class
  5  Supplier3     B
  6  Supplier3     B}
  </code></pre>
  
  <p>I need to split into separated dataframe so I did:</p>
  
  <pre><code>df3 = pd.DataFrame.from_dict({i:group for i,group in df1.groupby(df1['Supplier'].ne(df1['Supplier'].shift()).cumsum() )},orient='index', columns= ['Class'])
  </code></pre>
  
  <p>but it gives the error</p>
  
  <pre><code> df3 = pd.DataFrame.from_dict({i:group for i,group in df1.groupby(df1['Supplier'].ne(df1['Supplier'].shift()).cumsum() )},orient='index', columns= ['Class'])
  AttributeError: 'dict' object has no attribute 'groupby'
  </code></pre>