我想阅读一个简单的表格,使用 astropy.table。该行的第一个元素是一个大整数。它失败,并显示错误消息:“OverflowError: Python int too large to convert to C long”。我怎样才能避免这种情况?
细节:
该表在 test.cat 中。很简单,一行:81421100001 2 1 1 37.5991 1.0213 785.364 539.291
这是我使用的代码:
import numpy as np
from astropy.table import Table
catalog_filename = 'test.cat'
t = Table.read(catalog_filename, format='ascii')
我收到以下错误:
Traceback (most recent call last):
File "catread.py", line 15, in <module>
t = Table.read(catalog_filename, format='ascii')
File "/usr/local/lib/python2.7/dist-packages/astropy/table/table.py", line 2561, in read
return io_registry.read(cls, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/astropy/io/registry.py", line 319, in read
table = reader(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/astropy/io/ascii/connect.py", line 18, in read_asciitable
return read(filename, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/astropy/io/ascii/ui.py", line 154, in read
dat = _guess(table, new_kwargs)
File "/usr/local/lib/python2.7/dist-packages/astropy/io/ascii/ui.py", line 196, in _guess
dat = reader.read(table)
File "/usr/local/lib/python2.7/dist-packages/astropy/io/ascii/core.py", line 872, in read
table = self.outputter(cols, self.meta)
File "/usr/local/lib/python2.7/dist-packages/astropy/io/ascii/core.py", line 670, in __call__
self._convert_vals(cols)
File "/usr/local/lib/python2.7/dist-packages/astropy/io/ascii/core.py", line 652, in _convert_vals
col.data = converter_func(col.str_vals)
File "/usr/local/lib/python2.7/dist-packages/astropy/io/ascii/core.py", line 611, in converter
return numpy.array(vals, numpy_type)
OverflowError: Python int too large to convert to C long