如何解决'ValueError:基数为10的int()的文字无效:使用pandas阅读hdf5文件时'5,3,2''?

wfypjpf4  于 2023-06-04  发布在  其他
关注(0)|答案(1)|浏览(134)

我尝试使用Pandas读取hdf5文件,但得到此错误:
ValueError: invalid literal for int() with base 10: '5,3,2'
我只调用data = pd.read_hdf(path),所以我不知道我能改变什么。
该文件应该是好的,它可以使用pyCGNS包读取,但我想做的Pandas。
完整输出为:

runfile('D:/projekty/CGNS_Read/untitled3.py', wdir='D:/projekty/CGNS_Read')
Traceback (most recent call last):

  File C:\Program Files\Spyder\pkgs\spyder_kernels\py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File d:\projekty\cgns_read\untitled3.py:19
    data = pd.read_hdf(path + name)

  File C:\Program Files\Spyder\pkgs\pandas\io\pytables.py:420 in read_hdf
    store = HDFStore(path_or_buf, mode=mode, errors=errors, **kwargs)

  File C:\Program Files\Spyder\pkgs\pandas\io\pytables.py:560 in __init__
    tables = import_optional_dependency("tables")

  File C:\Program Files\Spyder\pkgs\pandas\compat\_optional.py:142 in import_optional_dependency
    module = importlib.import_module(name)

  File importlib\__init__.py:127 in import_module

  File <frozen importlib._bootstrap>:1014 in _gcd_import

  File <frozen importlib._bootstrap>:991 in _find_and_load

  File <frozen importlib._bootstrap>:975 in _find_and_load_unlocked

  File <frozen importlib._bootstrap>:671 in _load_unlocked

  File <frozen importlib._bootstrap_external>:848 in exec_module

  File <frozen importlib._bootstrap>:219 in _call_with_frames_removed

  File C:\Program Files\Spyder\Python\lib\site-packages\tables\__init__.py:100
    from .file import File, open_file, copy_file

  File C:\Program Files\Spyder\Python\lib\site-packages\tables\file.py:20
    import numexpr as ne

  File C:\Program Files\Spyder\Python\lib\site-packages\numexpr\__init__.py:44
    nthreads = _init_num_threads()

  File C:\Program Files\Spyder\Python\lib\site-packages\numexpr\utils.py:156 in _init_num_threads
    requested_threads = int(os.environ['OMP_NUM_THREADS'])

ValueError: invalid literal for int() with base 10: '5,3,2'
xfyts7mz

xfyts7mz1#

好了问题解决了对于任何人谁将处理同样的问题,解决方案是:

pip install --upgrade python-utils

这是一个表(或pytables)的依赖,这是一个pandas的依赖。

相关问题