title: Iterating over the attributes of pandas dataframe
body: <p>is there any way to access the <em>sample_count</em> variable? I want to save the count of d,h,o,s to some variable to access it later. </p>
  
  <p>Thanks.</p>
  
  <pre><code>a_train, a_test, b_train, b_test = train_test_split(features, labels, test_size = 0.30)
  
  df_1 = pd.DataFrame({'class': b_test,
                     'probability': range(1,158)}, columns=["class", "probability"])
  sample_count=df_1.groupby("class").count()
  print(sample_count)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/FZHoN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FZHoN.png" alt="Output:"></a></p>