1

pandas.DataFrame()ファイルサイズが約 47 GiB を超えた後、文字列値 (数値は OK) を HDF5 ストレージに追加するときに例外が発生します。文字列の最小サイズ、レコード数、列数も重要ではありません。ファイルサイズは重要です。

例外トレースの下部:

  File "..\..\hdf5-1.8.14\src\H5FDsec2.c", line 822, in H5FD_sec2_write
file write failed: time = Tue Aug 18 18:26:17 2015
, filename = 'large_file.h5', file descriptor = 4, errno = 22, error message = 'Invalid argument', buf = 0000000066A40018, total write size = 262095, bytes this sub-write = 262095, bytes actually written = 18446744073709551615, offset = 47615949533

再現するコード:

import numpy as np
import pandas as pd

for i in range(200):
    df = pd.DataFrame(np.char.mod('random string object (%f)', np.random.rand(5000000,3)), columns=('A','B','C'))
    print('writing chunk №', i, '...', end='', flush=True)
    with pd.HDFStore('large_file.h5') as hdf:
        # Construct unique index
        try:
            nrows = hdf.get_storer('df').nrows
        except:
            nrows = 0
        df.index = pd.Series(df.index) + nrows    

        # Append the dataframe to the storage. Exception hppens here
        hdf.append('df', df, format='table')
    print('done')

環境: Windows7 x64 マシン、python 3.4.3、pandas 0.16.2、pytables 3.2.0、HDF5 1.8.14。

問題は、問題が上記の python コードにある場合は問題を修正する方法、または HDF5 に関連する場合は問題を回避する方法です。ありがとう。

4

0 に答える 0