/usr/local/lib64/python3.6/site-packages/pyarrow
NameSizeModeActions
include/-0755rm
includes/-0755rm
tensorflow/-0755rm
tests/-0755rm
vendored/-0755rm
__pycache__/-0755rm
array.pxi796090644editdlrm
benchmark.pxi8690644editdlrm
benchmark.py8560644editdlrm
builder.pxi26880644editdlrm
cffi.py21780644editdlrm
compat.pxi18100644editdlrm
compat.py10760644editdlrm
compute.py228370644editdlrm
config.pxi26130644editdlrm
csv.py9620644editdlrm
cuda.py10870644editdlrm
dataset.py333330644editdlrm
error.pxi78070644editdlrm
feather.py92580644editdlrm
filesystem.py144680644editdlrm
flight.py17940644editdlrm
fs.py134440644editdlrm
gandiva.pyx184470644editdlrm
hdfs.py75270644editdlrm
io.pxi644950644editdlrm
ipc.pxi288210644editdlrm
ipc.py80290644editdlrm
json.py8580644editdlrm
jvm.py95930644editdlrm
lib.cpython-36m-x86_64-linux-gnu.so37605280755editdlrm
lib.pxd144420644editdlrm
lib.pyx43730644editdlrm
libarrow.so.600481626000755editdlrm
libarrow_dataset.so.60025411200755editdlrm
libarrow_flight.so.600129997840755editdlrm
libarrow_python.so.60018489200755editdlrm
libarrow_python_flight.so.6001127280755editdlrm
libparquet.so.60044585520755editdlrm
libplasma.so.6002512960755editdlrm
lib_api.h191530644editdlrm
memory.pxi74510644editdlrm
orc.py52690644editdlrm
pandas-shim.pxi79870644editdlrm
pandas_compat.py422430644editdlrm
parquet.py868440644editdlrm
plasma-store-server4827760755editdlrm
plasma.py60750644editdlrm
public-api.pxi128140644editdlrm
scalar.pxi291820644editdlrm
serialization.pxi190860644editdlrm
serialization.py182020644editdlrm
table.pxi722770644editdlrm
tensor.pxi343110644editdlrm
types.pxi794320644editdlrm
types.py103810644editdlrm
util.py50010644editdlrm
_compute.cpython-36m-x86_64-linux-gnu.so7173120755editdlrm
_compute.pxd11490644editdlrm
_compute.pyx417590644editdlrm
_csv.cpython-36m-x86_64-linux-gnu.so3121680755editdlrm
_csv.pxd16020644editdlrm
_csv.pyx392970644editdlrm
_cuda.pxd19220644editdlrm
_cuda.pyx347310644editdlrm
_dataset.cpython-36m-x86_64-linux-gnu.so10801680755editdlrm
_dataset.pxd16440644editdlrm
_dataset.pyx1200540644editdlrm
_dataset_orc.cpython-36m-x86_64-linux-gnu.so525360755editdlrm
_dataset_orc.pyx13450644editdlrm
_feather.cpython-36m-x86_64-linux-gnu.so942800755editdlrm
_feather.pyx36230644editdlrm
_flight.cpython-36m-x86_64-linux-gnu.so11246640755editdlrm
_flight.pyx935320644editdlrm
_fs.cpython-36m-x86_64-linux-gnu.so4699920755editdlrm
_fs.pxd24840644editdlrm
_fs.pyx400170644editdlrm
_generated_version.py1420644editdlrm
_hdfs.cpython-36m-x86_64-linux-gnu.so1273520755editdlrm
_hdfs.pyx54710644editdlrm
_hdfsio.cpython-36m-x86_64-linux-gnu.so2080960755editdlrm
_hdfsio.pyx136810644editdlrm
_json.cpython-36m-x86_64-linux-gnu.so906160755editdlrm
_json.pyx84060644editdlrm
_orc.cpython-36m-x86_64-linux-gnu.so1097760755editdlrm
_orc.pxd23500644editdlrm
_orc.pyx51510644editdlrm
_parquet.cpython-36m-x86_64-linux-gnu.so5077920755editdlrm
_parquet.pxd220840644editdlrm
_parquet.pyx479970644editdlrm
_plasma.cpython-36m-x86_64-linux-gnu.so2591680755editdlrm
_plasma.pyx294950644editdlrm
_s3fs.cpython-36m-x86_64-linux-gnu.so1994960755editdlrm
_s3fs.pyx116620644editdlrm
__init__.pxd21950644editdlrm
__init__.py212630644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/pyarrow/ipc.py (8029B)
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # Arrow file and stream reader/writer classes, and other messaging tools import os import pyarrow as pa from pyarrow.lib import (IpcWriteOptions, ReadStats, WriteStats, # noqa Message, MessageReader, RecordBatchReader, _ReadPandasMixin, MetadataVersion, read_message, read_record_batch, read_schema, read_tensor, write_tensor, get_record_batch_size, get_tensor_size) import pyarrow.lib as lib class RecordBatchStreamReader(lib._RecordBatchStreamReader): """ Reader for the Arrow streaming binary format. Parameters ---------- source : bytes/buffer-like, pyarrow.NativeFile, or file-like Python object Either an in-memory buffer, or a readable file object. """ def __init__(self, source): self._open(source) _ipc_writer_class_doc = """\ Parameters ---------- sink : str, pyarrow.NativeFile, or file-like Python object Either a file path, or a writable file object. schema : pyarrow.Schema The Arrow schema for data to be written to the file. options : pyarrow.ipc.IpcWriteOptions Options for IPC serialization. If None, default values will be used: the legacy format will not be used unless overridden by setting the environment variable ARROW_PRE_0_15_IPC_FORMAT=1, and the V5 metadata version will be used unless overridden by setting the environment variable ARROW_PRE_1_0_METADATA_VERSION=1. use_legacy_format : bool, default None Deprecated in favor of setting options. Cannot be provided with options. If None, False will be used unless this default is overridden by setting the environment variable ARROW_PRE_0_15_IPC_FORMAT=1""" class RecordBatchStreamWriter(lib._RecordBatchStreamWriter): __doc__ = """Writer for the Arrow streaming binary format {}""".format(_ipc_writer_class_doc) def __init__(self, sink, schema, *, use_legacy_format=None, options=None): options = _get_legacy_format_default(use_legacy_format, options) self._open(sink, schema, options=options) class RecordBatchFileReader(lib._RecordBatchFileReader): """ Class for reading Arrow record batch data from the Arrow binary file format Parameters ---------- source : bytes/buffer-like, pyarrow.NativeFile, or file-like Python object Either an in-memory buffer, or a readable file object footer_offset : int, default None If the file is embedded in some larger file, this is the byte offset to the very end of the file data """ def __init__(self, source, footer_offset=None): self._open(source, footer_offset=footer_offset) class RecordBatchFileWriter(lib._RecordBatchFileWriter): __doc__ = """Writer to create the Arrow binary file format {}""".format(_ipc_writer_class_doc) def __init__(self, sink, schema, *, use_legacy_format=None, options=None): options = _get_legacy_format_default(use_legacy_format, options) self._open(sink, schema, options=options) def _get_legacy_format_default(use_legacy_format, options): if use_legacy_format is not None and options is not None: raise ValueError( "Can provide at most one of options and use_legacy_format") elif options: if not isinstance(options, IpcWriteOptions): raise TypeError("expected IpcWriteOptions, got {}" .format(type(options))) return options metadata_version = MetadataVersion.V5 if use_legacy_format is None: use_legacy_format = \ bool(int(os.environ.get('ARROW_PRE_0_15_IPC_FORMAT', '0'))) if bool(int(os.environ.get('ARROW_PRE_1_0_METADATA_VERSION', '0'))): metadata_version = MetadataVersion.V4 return IpcWriteOptions(use_legacy_format=use_legacy_format, metadata_version=metadata_version) def new_stream(sink, schema, *, use_legacy_format=None, options=None): return RecordBatchStreamWriter(sink, schema, use_legacy_format=use_legacy_format, options=options) new_stream.__doc__ = """\ Create an Arrow columnar IPC stream writer instance {}""".format(_ipc_writer_class_doc) def open_stream(source): """ Create reader for Arrow streaming format. Parameters ---------- source : bytes/buffer-like, pyarrow.NativeFile, or file-like Python object Either an in-memory buffer, or a readable file object. Returns ------- reader : RecordBatchStreamReader """ return RecordBatchStreamReader(source) def new_file(sink, schema, *, use_legacy_format=None, options=None): return RecordBatchFileWriter(sink, schema, use_legacy_format=use_legacy_format, options=options) new_file.__doc__ = """\ Create an Arrow columnar IPC file writer instance {}""".format(_ipc_writer_class_doc) def open_file(source, footer_offset=None): """ Create reader for Arrow file format. Parameters ---------- source : bytes/buffer-like, pyarrow.NativeFile, or file-like Python object Either an in-memory buffer, or a readable file object. footer_offset : int, default None If the file is embedded in some larger file, this is the byte offset to the very end of the file data. Returns ------- reader : RecordBatchFileReader """ return RecordBatchFileReader(source, footer_offset=footer_offset) def serialize_pandas(df, *, nthreads=None, preserve_index=None): """ Serialize a pandas DataFrame into a buffer protocol compatible object. Parameters ---------- df : pandas.DataFrame nthreads : int, default None Number of threads to use for conversion to Arrow, default all CPUs. preserve_index : bool, default None The default of None will store the index as a column, except for RangeIndex which is stored as metadata only. If True, always preserve the pandas index data as a column. If False, no index information is saved and the result will have a default RangeIndex. Returns ------- buf : buffer An object compatible with the buffer protocol. """ batch = pa.RecordBatch.from_pandas(df, nthreads=nthreads, preserve_index=preserve_index) sink = pa.BufferOutputStream() with pa.RecordBatchStreamWriter(sink, batch.schema) as writer: writer.write_batch(batch) return sink.getvalue() def deserialize_pandas(buf, *, use_threads=True): """Deserialize a buffer protocol compatible object into a pandas DataFrame. Parameters ---------- buf : buffer An object compatible with the buffer protocol. use_threads : bool, default True Whether to parallelize the conversion using multiple threads. Returns ------- df : pandas.DataFrame """ buffer_reader = pa.BufferReader(buf) with pa.RecordBatchStreamReader(buffer_reader) as reader: table = reader.read_all() return table.to_pandas(use_threads=use_threads)