How to use the awkward.arrow.fromarrow function in awkward

To help you get started, we’ve selected a few awkward examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scikit-hep / awkward-array / tests / test_arrow.py View on Github external
def test_arrow_null_dictarray(self):
        if pyarrow is None:
            pytest.skip("unable to import pyarrow")
        else:
            a = pyarrow.DictionaryArray.from_arrays(pyarrow.array([0, 0, 2, 2, 1, 0, 2, 1, 1]), pyarrow.array(["one", None, "three"]))
            assert awkward.arrow.fromarrow(a).tolist() == ["one", "one", "three", "three", None, "one", "three", None, None]
github scikit-hep / awkward-array / tests / test_arrow.py View on Github external
def test_arrow_union_dense(self):
        if pyarrow is None:
            pytest.skip("unable to import pyarrow")
        else:
            a = pyarrow.UnionArray.from_dense(pyarrow.array([0, 1, 0, 0, 0, 1, 1], type=pyarrow.int8()), pyarrow.array([0, 0, 1, 2, 3, 1, 2], type=pyarrow.int32()), [pyarrow.array([0.0, 1.1, 2.2, 3.3]), pyarrow.array([True, True, False])])
            assert awkward.arrow.fromarrow(a).tolist() == [0.0, True, 1.1, 2.2, 3.3, True, False]
github scikit-hep / awkward-array / tests / test_arrow.py View on Github external
def test_arrow_dictarray(self):
        if pyarrow is None:
            pytest.skip("unable to import pyarrow")
        else:
            a = pyarrow.DictionaryArray.from_arrays(pyarrow.array([0, 0, 2, 2, 1, 0, 2, 1, 1]), pyarrow.array(["one", "two", "three"]))
            assert awkward.arrow.fromarrow(a).tolist() == ["one", "one", "three", "three", "two", "one", "three", "two", "two"]
github scikit-hep / awkward-array / tests / test_arrow.py View on Github external
def test_arrow_nonnullable_table(self):
        if pyarrow is None:
            pytest.skip("unable to import pyarrow")
        else:
            x = pyarrow.array([1, 2, 3])
            y = pyarrow.array([1.1, 2.2, 3.3])
            table = pyarrow.Table.from_arrays([x], ["x"])
            table2 = table.add_column(1, pyarrow.column(pyarrow.field("y", y.type, False), numpy.array([1.1, 2.2, 3.3])))
            assert awkward.arrow.fromarrow(table2).tolist() == [{"x": 1, "y": 1.1}, {"x": 2, "y": 2.2}, {"x": 3, "y": 3.3}]
github scikit-hep / awkward-array / tests / test_arrow.py View on Github external
def test_arrow_union_sparse_null_null(self):
        if pyarrow is None:
            pytest.skip("unable to import pyarrow")
        else:
            a = pyarrow.UnionArray.from_sparse(pyarrow.array([0, 1, 0, 0, 1], type=pyarrow.int8()), [pyarrow.array([0.0, 1.1, None, 3.3, 4.4]), pyarrow.array([True, None, False, True, False])])
            assert awkward.arrow.fromarrow(a).tolist() == [0.0, None, None, 3.3, False]
github scikit-hep / awkward-array / tests / test_arrow.py View on Github external
def test_arrow_dictarray_null(self):
        if pyarrow is None:
            pytest.skip("unable to import pyarrow")
        else:
            a = pyarrow.DictionaryArray.from_arrays(pyarrow.array([0, 0, 2, None, 1, None, 2, 1, 1]), pyarrow.array(["one", "two", "three"]))
            assert awkward.arrow.fromarrow(a).tolist() == ["one", "one", "three", None, "two", None, "three", "two", "two"]
github scikit-hep / awkward-array / tests / test_arrow.py View on Github external
def test_arrow_nested_array(self):
        if pyarrow is None:
            pytest.skip("unable to import pyarrow")
        else:
            a = pyarrow.array([[1.1, 2.2, 3.3], [], [4.4, 5.5]])
            assert awkward.arrow.fromarrow(a).tolist() == [[1.1, 2.2, 3.3], [], [4.4, 5.5]]
github scikit-hep / awkward-array / tests / test_arrow.py View on Github external
def test_arrow_union_dense_null(self):
        if pyarrow is None:
            pytest.skip("unable to import pyarrow")
        else:
            a = pyarrow.UnionArray.from_dense(pyarrow.array([0, 1, 0, 0, 0, 1, 1], type=pyarrow.int8()), pyarrow.array([0, 0, 1, 2, 3, 1, 2], type=pyarrow.int32()), [pyarrow.array([0.0, 1.1, None, 3.3]), pyarrow.array([True, True, False])])
            assert awkward.arrow.fromarrow(a).tolist() == [0.0, True, 1.1, None, 3.3, True, False]
github scikit-hep / awkward-array / tests / test_arrow.py View on Github external
def test_arrow_union_sparse_null(self):
        if pyarrow is None:
            pytest.skip("unable to import pyarrow")
        else:
            a = pyarrow.UnionArray.from_sparse(pyarrow.array([0, 1, 0, 0, 1], type=pyarrow.int8()), [pyarrow.array([0.0, 1.1, None, 3.3, 4.4]), pyarrow.array([True, True, False, True, False])])
            assert awkward.arrow.fromarrow(a).tolist() == [0.0, True, None, 3.3, False]
github scikit-hep / awkward-array / tests / test_arrow.py View on Github external
def test_arrow_nested_strings_null(self):
        if pyarrow is None:
            pytest.skip("unable to import pyarrow")
        else:
            a = pyarrow.array([["one", "two", None], [], ["four", "five"]])
            assert awkward.arrow.fromarrow(a).tolist() == [["one", "two", None], [], ["four", "five"]]