Python 附加重新排列的pytables
我在csv文件中有股票行情数据,在我的一生中,我无法理解为什么批量插入不起作用。我创建了名为insert_记录的重新排列,其类型如下:Python 附加重新排列的pytables,python,Python,我在csv文件中有股票行情数据,在我的一生中,我无法理解为什么批量插入不起作用。我创建了名为insert_记录的重新排列,其类型如下: [('id', 'O'), ('dt', '<i8'), ('adj_dt', '<i8'), ('currency', 'O'), ('close', '<f8'), ('open', '<f8'), ('high', '<f8'), ('low', '<f8'), ('volume', '<f8')] 这项工作
[('id', 'O'), ('dt', '<i8'), ('adj_dt', '<i8'), ('currency', 'O'), ('close', '<f8'), ('open', '<f8'), ('high', '<f8'), ('low', '<f8'), ('volume', '<f8')]
这项工作:
这并不是:
table.append(insert_records)
我得到这个错误
ValueError("rows parameter cannot be converted into a recarray object compliant with table '/TD/date_20130102 (Table(0,), shuffle, zlib(9)) '20130102''. The error was: <Cannot change data-type for object array.>",)
rows parameter cannot be converted into a recarray object compliant with table '/TD/date_20130102 (Table(0,), shuffle, zlib(9)) '20130102''. The error was: <Cannot change data-type for object array.>
ValueError(“rows参数无法转换为符合表'/TD/date_20130102(表(0),shuffle,zlib(9))'20130102'的recarray对象。错误为:,)
rows参数无法转换为符合表“/TD/date_20130102(表(0),shuffle,zlib(9))“20130102”的recarray对象。错误是:
此错误指的是什么?python对象不能用于附加到pytables。pytables需要精确的重新排列数据类型 如果更改了数据类型,则会追加此项
dtype[0] = "|S14"
ValueError("rows parameter cannot be converted into a recarray object compliant with table '/TD/date_20130102 (Table(0,), shuffle, zlib(9)) '20130102''. The error was: <Cannot change data-type for object array.>",)
rows parameter cannot be converted into a recarray object compliant with table '/TD/date_20130102 (Table(0,), shuffle, zlib(9)) '20130102''. The error was: <Cannot change data-type for object array.>
dtype[0] = "|S14"