title: Python Pandas: Adding methods to class pandas.core.series.Series
body: <p>I want to work with a time series in Python and, therefore, Pandas' Series class is just perfect and has a lot of useful methods.</p>
  
  <p>Now I want to add some methods that I need and are not implemented. For example, let us say I am interested in adding a method which appends two times one value to the time series, at let us call that method <code>append2</code>:</p>
  
  <pre><code>import pandas                                                                         
  import random                                                                         
  
  class Testclass(pandas.core.series.Series):                                           
          def append2(self, val):                                                       
                  return self.append(val).append(val)                                   
  
  dates = pandas.date_range('1/1/2011', periods=72, freq='H')                           
  data = [random.randint(20, 100) for x in range(len(dates))]                           
  ts = pandas.Series(data, index=dates)                                                 
  
  a = Testclass()                                                                       
  b = a.append2(ts[[1]])                                                                
  
  print type(a)                                                                         
  print type(b)
  </code></pre>
  
  <p>Now I find that the class of <code>a</code> and the class of <code>b</code> are different; <code>b</code> is a <code>pandas.core.series.Series</code> object and therefore you can not apply the method <code>append2</code> to it.</p>
  
  <p>I would like <code>b</code> to conserve the <code>append2</code> method (conserve the same class as <code>a</code>). Is that possible? Is there any other way to add methods to the Series class without modifying the source code of the Pandas package?</p>