title: How I do find median using pandas on a dataset?
body: <p>I have dataframe data which has 3 columns - Date, segment and metric. I am doing the following:</p>
  
  <pre><code>data = pandas.read_csv("Filename.csv")
  ave = data.groupby('Segment').mean() #works
  ave = data.groupby('Segment').median() #gives error
  ave['median'] = data.groupby('Segment').median()
  
  Traceback (most recent call last):
    File "&lt;input&gt;", line 1, in &lt;module&gt;
    File "/usr/lib/pymodules/python2.7/pandas/core/frame.py", line 1453, in __setitem__
      self._set_item(key, value)
    File "/usr/lib/pymodules/python2.7/pandas/core/frame.py", line 1488, in _set_item
      NDFrame._set_item(self, key, value)
    File "/usr/lib/pymodules/python2.7/pandas/core/generic.py", line 301, in _set_item
      self._data.set(key, value)
    File "/usr/lib/pymodules/python2.7/pandas/core/internals.py", line 616, in set
      assert(value.shape[1:] == self.shape[1:])
  AssertionError
  </code></pre>