title: What is the elegant way to set start and end of indexing of Pandas
body: <p>I'd like to retrieve data from Pandas data frame with optional start and end index. For example, an ugly way is like this </p>
  
  <pre><code>def get_data(self, start=None, end=None):
     if start is None and end is not None:
        return self.data[:end]
     if start is not None and end is None:
        return self.data[start:]
     if start is not None and end is not None:
        return self.data[start:end]
  </code></pre>
  
  <p>Is there any elegant way to do this? Thanks!</p>