From 27e184a36738d00d0ce10641eef439774f4ad5da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kriszti=C3=A1n=20Sz=C5=B1cs?= Date: Wed, 4 Aug 2021 15:36:50 +0200 Subject: [PATCH] Add timestamp types to dataframe_with_lists example data --- python/pyarrow/tests/pandas_examples.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/python/pyarrow/tests/pandas_examples.py b/python/pyarrow/tests/pandas_examples.py index 466c14eeb6f5f..98473b9736fcb 100644 --- a/python/pyarrow/tests/pandas_examples.py +++ b/python/pyarrow/tests/pandas_examples.py @@ -16,7 +16,7 @@ # under the License. from collections import OrderedDict -from datetime import date, time +from datetime import date, time, datetime import numpy as np import pandas as pd @@ -143,13 +143,27 @@ def dataframe_with_lists(include_index=False, parquet_compatible=False): None, [time(0, 0, 0), time(18, 0, 2), time(12, 7, 3)] ] + datetime_data = [ + [datetime(2015, 1, 5, 12, 0, 0), datetime(2020, 8, 22, 10, 5, 0)], + [datetime(2024, 5, 5, 5, 49, 1), datetime(2015, 12, 24, 22, 10, 17)], + [datetime(1996, 4, 30, 2, 38, 11)], + None, + [datetime(1987, 1, 27, 8, 21, 59)] + ] + pandas_timestamp_data = [ + list(map(pd.Timestamp, x)) if x else None for x in datetime_data + ] temporal_pairs = [ (pa.date32(), date_data), (pa.date64(), date_data), (pa.time32('s'), time_data), (pa.time32('ms'), time_data), - (pa.time64('us'), time_data) + (pa.time64('us'), time_data), + (pa.timestamp('s'), datetime_data), + (pa.timestamp('ms'), datetime_data), + (pa.timestamp('us'), datetime_data), + (pa.timestamp('ns'), pandas_timestamp_data), ] if not parquet_compatible: temporal_pairs += [