PerformanceWarning - 熊猫和Pytables,我能解决这个问题吗?

时间:2014-08-10 20:28:04

标签: python performance pandas pytables

我收到以下PerformanceWarning:

"PerformanceWarning: 
your performance may suffer as PyTables will pickle object types that it cannot
map directly to c-types [inferred_type->mixed-integer,key->block0_values] [items->   ['File1', 'File2', 'File3', 'File4', 'File5']]

warnings.warn(ws, PerformanceWarning)"

这是因为" file_attributes" df(见下面的代码),其中包含几个内容:

store.file_attributes的典型输出(基本上是一堆带有一些嵌套字典的字典键/值对):

File1 \

持续时间0.2
linescan文件GluAlone-001_Cycle00001_LineProfileData.csv
小学{'单位':' mV','除数':0.1}
抽样20000
中学{'单位':' pA','除数':0.0005}
电压记录文件GluAlone-001_Cycle00001_VoltageRecording_001

File2 \

持续时间0.2
linescan文件GluAlone-001_Cycle00002_LineProfileData.csv
小学{'单位':' mV','除数':0.1}
抽样20000
中学{'单位':' pA','除数':0.0005}
电压记录文件GluAlone-001_Cycle00002_VoltageRecording_001

ETC。

我为此编写的功能是从另一个解析数据文件夹的函数中提取数据:

def convert_folder_hdf5(folder, save_loc = None):
    if save_loc==None:
        save_loc = folder

    filename = save_loc+ '\\' + (folder.split('\\')[-1])+'.h5'
    store = pd.HDFStore(filename, format = "table", complevel=9, complib='blosc')
    data = import_folder(folder)

    store['voltage_recording'] = data['voltage recording']
    store['linescan'] = data['linescan']
    store['file_attributes'] = pd.DataFrame.from_dict(data['file attributes'])


    #store.close()

    return store
但是,我不知道如何处理这个警告。在这两个帖子中搜索,我发现这可能是合适的解决方案,并没有让我到任何地方。

有什么想法吗?

0 个答案:

没有答案