[AstroPy] ValueError in vstacking tables

Brian Cherinka cherinka at di.utoronto.ca
Wed Jun 17 14:08:59 EDT 2015


Hi, 

I’m trying to vstack (vertically stack) two Astropy tables with different numbers of columns.  The tables appear to stack correctly without error. However, upon attempting to index a row in the table, it throws me this error

<repr(<astropy.table.row.Row at 0x10c72ed50>) failed: ValueError: setting an array element with a sequence.>

I’m not trying to do anything fancy with mixed columns, or Quantities.  Just stackin’ two good ol’ natural Tables together.     One table has 84 columns, and another has 57, which are all a part of the 84 in the first table.  At first glance I would guess it’s a mismatch in the dtypes of a particular column that I’m trying to merge.  However, the columns all have the same dtype, format, and they are in the same order.  I get no messages regarding any kind of merge errors.  

Any ideas on this?

Thanks, Brian

P.S. Full print of traceback below

table3 = vstack([table1, table3],join_type=‘outer’)
print table3[0] 
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-278-a0c75e8d3ef3> in <module>()
----> 1 print tmp3[0]

/Users/Brian/anaconda/lib/python2.7/site-packages/astropy/table/row.pyc in __repr__(self)
    176     def __repr__(self):
    177         return "<{3} {0} of table\n values={1!r}\n dtype={2}>".format(
--> 178             self.index, self.as_void(), self.dtype, self.__class__.__name__)
    179
    180

/Users/Brian/anaconda/lib/python2.7/site-packages/numpy/ma/core.pyc in __repr__(self)
   5699             return self._data.__repr__()
   5700         m = tuple(m)
-> 5701         if not any(m):
   5702             return self._data.__repr__()
   5703         p = masked_print_option

/Users/Brian/anaconda/lib/python2.7/site-packages/numpy/ma/core.pyc in __call__(self, a, *args, **params)
   6089         method = getattr(MaskedArray, method_name, None)
   6090         if method is not None:
-> 6091             return method(MaskedArray(a), *args, **params)
   6092         # Still here ? OK, let's call the corresponding np function
   6093         method = getattr(np, method_name)

/Users/Brian/anaconda/lib/python2.7/site-packages/numpy/ma/core.pyc in __new__(cls, data, mask, dtype, copy, subok, ndmin, fill_value, keep_mask, hard_mask, shrink, **options)
   2649         """
   2650         # Process data............
-> 2651         _data = np.array(data, dtype=dtype, copy=copy, subok=True, ndmin=ndmin)
   2652         _baseclass = getattr(data, '_baseclass', type(_data))
   2653         # Check that we're not erasing the mask..........

ValueError: setting an array element with a sequence.




---------------------------------------
Brian Cherinka, Ph.D
Dunlap Institute for Astronomy & Astrophysics
University of Toronto
Toronto, ON, Canada M5S 3H4 
phone: 416-978-7299
email: cherinka at di.utoronto.ca
----------------------------------------




More information about the AstroPy mailing list