• G. Mias Lab »
  • Data Storage

    Submodule pyiomica.dataStorage

    Data storage functions

    Functions:

    read(fileName[, withPKLZextension, ...])

    Read object from a file recorded by function "write".

    write(data, fileName[, withPKLZextension, ...])

    Write object into a file.

    read(fileName, withPKLZextension=True, hdf5fileName=None, jsonFormat=False)[source]

    Read object from a file recorded by function “write”. Pandas and Numpy objects are read from HDF5 file when provided, otherwise attempt to read from PKLZ file.

    Parameters:
    fileName: str

    Path of directories ending with the file name

    withPKLZextension: boolean, Default True

    Add “.pklz” to a pickle file

    hdf5fileName: str, Default None

    Path of directories ending with the file name. If None then data is read from a pickle file

    jsonFormat: boolean, Default False

    Save data into compressed json file

    Returns:
    data

    Data object to write into a file

    Usage:

    exampleDataFrame = read(‘/dir1/exampleDataFrame’, hdf5fileName=’/dir2/data.h5’)

    write(data, fileName, withPKLZextension=True, hdf5fileName=None, jsonFormat=False)[source]

    Write object into a file. Pandas and Numpy objects are recorded in HDF5 format when ‘hdf5fileName’ is provided otherwise pickled into a new file.

    Parameters:
    data: any type

    Data object to write into a file

    fileName: str

    Path of directories ending with the file name

    withPKLZextension: boolean, Default True

    Add “.pklz” to a pickle file

    hdf5fileName: str, Default None

    Path of directories ending with the file name. If None then data is pickled

    jsonFormat: boolean, Default False

    Save data into compressed json file

    Returns:

    None

    Usage:

    write(exampleDataFrame, ‘/dir1/exampleDataFrame’, hdf5fileName=’/dir2/data.h5’)