docs: def to_pandas(self):
          """Convert this array into a pandas object with the same shape.
  
          The type of the returned object depends on the number of DataArray
          dimensions:
  
          * 1D -> `pandas.Series`
          * 2D -> `pandas.DataFrame`
          * 3D -> `pandas.Panel`
  
          Only works for arrays with 3 or fewer dimensions.
  
          The DataArray constructor performs the inverse transformation.
          """
          # TODO: consolidate the info about pandas constructors and the
          # attributes that correspond to their indexes into a separate module?
          constructors = {0: lambda x: x,
                          1: pd.Series,
                          2: pd.DataFrame,
                          3: pd.Panel}
          try:
              constructor = constructors[self.ndim]
          except KeyError:
              raise ValueError('cannot convert arrays with %s dimensions into '
                               'pandas objects' % self.ndim)
          indexes = [self.get_index(dim) for dim in self.dims]
          return constructor(self.values, *indexes)