From 193427fdda5d2ebbabd216d4f670baa88a0dec94 Mon Sep 17 00:00:00 2001 From: Alif Be Date: Tue, 14 Nov 2023 11:06:59 +0100 Subject: [PATCH] Fix pyarrow issues --- ecl2df/wellcompletiondata.py | 2 +- tests/test_summary.py | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/ecl2df/wellcompletiondata.py b/ecl2df/wellcompletiondata.py index e7d225a04..a58437f73 100644 --- a/ecl2df/wellcompletiondata.py +++ b/ecl2df/wellcompletiondata.py @@ -228,7 +228,7 @@ def _df2pyarrow(dframe: pd.DataFrame) -> pyarrow.Table: else: field_metadata = {} if colname == "DATE": - dtype = pyarrow.timestamp("ms") + dtype = pyarrow.timestamp("ns") elif pd.api.types.is_integer_dtype(dframe.dtypes[colname]): dtype = pyarrow.int32() elif pd.api.types.is_string_dtype(dframe.dtypes[colname]): diff --git a/tests/test_summary.py b/tests/test_summary.py index d5f138cbb..e52960750 100644 --- a/tests/test_summary.py +++ b/tests/test_summary.py @@ -1118,13 +1118,6 @@ def test_df2pyarrow_500years(): dframe.index.name = "BOGUS" pyat = _df2pyarrow(dframe) - # pylint: disable=c-extension-no-member - with pytest.raises(pyarrow.lib.ArrowInvalid): - # We cannot convert this back to Pandas, since it will bail on failing - # to use nanosecond timestamps in the dataframe object for these dates. - # This is maybe a PyArrow bug/limitation that we must be aware of. - pyat.to_pandas() - assert ( np.array(pyat.column(0)) == [