title: Size and percentage of elements
body: <p>I'm reading a CSV file with pandas and after I read the file I'd like to calculate 2 things:</p>
  
  <ol>
  <li>Number of items </li>
  <li>% of items</li>
  </ol>
  
  <p>For example if my data is <code>[X,X,Y,Z,Z,X,X,Y,Z,Y]</code> , I want my output to be</p>
  
  <pre><code>X 4 40.0
  Y 3 30.0
  Z 3 30.0
  </code></pre>
  
  <p>I tried the following but it only outputs the sums</p>
  
  <pre><code>train = pd.read_csv("./../input/train.csv")
  grouped = train.groupby([x ,y]).size()
  </code></pre>
  
  <p>And this only calculates the percentages:</p>
  
  <pre><code>train = pd.read_csv("./../input/train.csv")
  grouped = grouped.groupby(level=[0]).apply(lambda x: x / x.sum())
  </code></pre>
  
  <p>How can I get both?</p>