gpt4 book ai didi

python - ``/`` 字符不允许出现在对象名称中

转载 作者:太空宇宙 更新时间:2023-11-04 05:51:25 25 4
gpt4 key购买 nike

我正在使用 HDF5 文件中的结构,该结构的名称中包含“/”。当我加载所述文件时,我收到此警告:

 ⓔ  develop  In [1]  import pandas as pd

ⓔ develop  In [2]  store = pd.HDFStore('data/XXX-20150423-071618.h5')

ⓔ develop  In [3]  store
/home/XXX/virt/env/develop/lib/python2.7/site-packages/tables/group.
py:1156: UserWarning: problems loading leaf ``/log``::

the ``/`` character is not allowed in object names: 'XXX/align/aft_port_end/extend_pressure'

The leaf will become an ``UnImplemented`` node.
% (self._g_join(childname), exc))

我们可以改变这些,但这将是一个主要的 PITA,并且会涉及破解现有的关键文件。因此,尽管可能我们不希望这样做。

有什么方法可以在名称中包含“/”,还是不支持?

>>> pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.5.final.0
python-bits: 64
OS: Linux
OS-release: 3.10.0-229.1.2.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8

pandas: 0.16.0
nose: 1.3.6
Cython: 0.22
numpy: 1.9.2
scipy: 0.15.1
statsmodels: None
IPython: 3.0.0
sphinx: 1.2.3
patsy: None
dateutil: 2.4.2
pytz: 2015.2
bottleneck: None
tables: 3.1.1
numexpr: 2.2.2
matplotlib: 1.4.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 0.9.7
pymysql: None
psycopg2: None

最佳答案

从技术上讲,该文件是非法的 HDF5 - official spec in 5.2. HDF5 Path Names and Navigation清楚地将 Name 定义为非斜线字符的字符串。因此,PyTables 在这里拒绝您的输入并没有错(并且通过简单地回退到 UnImplemented 节点是相当亲切的)。

就是说,如果您不害怕破解 PyTables,您可以禁用来自 tables/path.py 的违规检查。 .据我所知,这样做的唯一副作用是无法使用自然命名使用对象,但这不太可能是什么大问题。

(注意:我以前没有使用过 PyTables,所以这完全基于我对代码的阅读。)

关于python - ``/`` 字符不允许出现在对象名称中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30046902/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com