[AstroPy] Accessing a FITS table generates "ValueError: Inconsistent data column lengths: set([0, 27645])"

Derek Homeier derek at astro.physik.uni-goettingen.de
Tue Apr 17 19:18:04 EDT 2018


On 18 Apr 2018, at 12:59 am, Jordan Alexander <jordan.alexander at aut.ac.nz> wrote:
> 
> Your "tested" work-around, Tom:
> 
> hdulist.info()
> dat = hdulist[8].data
> names = [name for name in dat.dtype.names if name != 'col_with_0J']
> cols = [dat[name] for name in names]
> tbl = Table(cols, names=names)

‘col_with_0J’ was meant to be the actual column name of the 0-width column (#12).

names = [name for name in dat.dtype.names if dat[name].shape[-1] > 0]

should automatically filter the 0-shaped columns out.

Cheers,
					Derek



More information about the AstroPy mailing list