

def to_msgpack(path_or_buf, *args, **kwargs):
    '\n    msgpack (serialize) object to input file path\n\n    THIS IS AN EXPERIMENTAL LIBRARY and the storage format\n    may not be stable until a future release.\n\n    Parameters\n    ----------\n    path_or_buf : string File path, buffer-like, or None\n                  if None, return generated string\n    args : an object or objects to serialize\n    encoding: encoding for unicode objects\n    append : boolean whether to append to an existing msgpack\n             (default is False)\n    compress : type of compressor (zlib or blosc), default to None (no\n               compression)\n    '
    global compressor
    compressor = kwargs.pop('compress', None)
    if compressor:
        compressor = u(compressor)
    append = kwargs.pop('append', None)
    if append:
        mode = 'a+b'
    else:
        mode = 'wb'

    def writer(fh):
        for a in args:
            fh.write(pack(a, **kwargs))
    if isinstance(path_or_buf, compat.string_types):
        with open(path_or_buf, mode) as fh:
            writer(fh)
    elif (path_or_buf is None):
        buf = compat.BytesIO()
        writer(buf)
        return buf.getvalue()
    else:
        writer(path_or_buf)

dataset/ETHPy150Open pydata/pandas/pandas/io/packers.py to_msgpack/original