diff --git a/python/pyarrow/tests/parquet/common.py b/python/pyarrow/tests/parquet/common.py index cbff41c7b10..09bc1ed7b3b 100644 --- a/python/pyarrow/tests/parquet/common.py +++ b/python/pyarrow/tests/parquet/common.py @@ -172,8 +172,8 @@ def alltypes_sample(size=10000, seed=0, categorical=False): # TODO(wesm): Test other timestamp resolutions now that arrow supports # them 'datetime': np.arange("2016-01-01T00:00:00.001", size, - dtype='datetime64[ms]'), - 'timedelta': np.arange(0, size, dtype="timedelta64[s]"), + dtype='datetime64[ms]').astype('datetime64[ns]'), + 'timedelta': np.arange(0, size, dtype="timedelta64[ns]"), 'str': pd.Series([str(x) for x in range(size)]), 'empty_str': [''] * size, 'str_with_nulls': [None] + [str(x) for x in range(size - 2)] + [None], diff --git a/python/pyarrow/tests/parquet/test_dataset.py b/python/pyarrow/tests/parquet/test_dataset.py index 6fdc7435418..ef75c3efac7 100644 --- a/python/pyarrow/tests/parquet/test_dataset.py +++ b/python/pyarrow/tests/parquet/test_dataset.py @@ -1252,6 +1252,7 @@ def _test_write_to_dataset_with_partitions(base_path, 'nan': [np.nan] * 10, 'date': np.arange('2017-01-01', '2017-01-11', dtype='datetime64[D]')}) + output_df["date"] = output_df["date"].astype('datetime64[ns]') cols = output_df.columns.tolist() partition_by = ['group1', 'group2'] output_table = pa.Table.from_pandas(output_df, schema=schema, safe=False, @@ -1312,6 +1313,7 @@ def _test_write_to_dataset_no_partitions(base_path, 'num': list(range(10)), 'date': np.arange('2017-01-01', '2017-01-11', dtype='datetime64[D]')}) + output_df["date"] = output_df["date"].astype('datetime64[ns]') cols = output_df.columns.tolist() output_table = pa.Table.from_pandas(output_df) @@ -1440,6 +1442,7 @@ def test_write_to_dataset_with_partitions_and_custom_filenames( 'nan': [np.nan] * 10, 'date': np.arange('2017-01-01', '2017-01-11', dtype='datetime64[D]')}) + output_df["date"] = output_df["date"].astype('datetime64[ns]') partition_by = ['group1', 'group2'] output_table = pa.Table.from_pandas(output_df) path = str(tempdir) diff --git a/python/pyarrow/tests/test_pandas.py b/python/pyarrow/tests/test_pandas.py index 7022441396e..f843904f126 100644 --- a/python/pyarrow/tests/test_pandas.py +++ b/python/pyarrow/tests/test_pandas.py @@ -69,7 +69,7 @@ def _alltypes_example(size=100): # TODO(wesm): Pandas only support ns resolution, Arrow supports s, ms, # us, ns 'datetime': np.arange("2016-01-01T00:00:00.001", size, - dtype='datetime64[ms]'), + dtype='datetime64[ms]').astype("datetime64[ns]"), 'str': [str(x) for x in range(size)], 'str_with_nulls': [None] + [str(x) for x in range(size - 2)] + [None], 'empty_str': [''] * size @@ -1016,7 +1016,7 @@ def test_timestamps_with_timezone(self): '2007-07-13T01:23:34.123', '2006-01-13T12:34:56.432', '2010-08-13T05:46:57.437'], - dtype='datetime64[ms]') + dtype='datetime64[ms]').astype("datetime64[ns]") }) df['datetime64'] = df['datetime64'].dt.tz_localize('US/Eastern') _check_pandas_roundtrip(df) @@ -2718,7 +2718,7 @@ def test_strided_data_import(self): cases.append(boolean_objects) cases.append(np.arange("2016-01-01T00:00:00.001", N * K, - dtype='datetime64[ms]') + dtype='datetime64[ms]').astype("datetime64[ns]") .reshape(N, K).copy()) strided_mask = (random_numbers > 0).astype(bool)[:, 0]