You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/08/04 14:47:59 UTC

[GitHub] [arrow] kszucs commented on a change in pull request #10866: ARROW-3448: [Python] Add test for roundtrip of pandas DataFrame with column of lists of datetime objects

kszucs commented on a change in pull request #10866:
URL: https://github.com/apache/arrow/pull/10866#discussion_r682688514



##########
File path: python/pyarrow/tests/pandas_examples.py
##########
@@ -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),

Review comment:
       Yes:
   ```python
   E   AssertionError: DataFrame.iloc[:, 12] (column name="timestamp[ns]_list") are different
   E
   E   DataFrame.iloc[:, 12] (column name="timestamp[ns]_list") values are different (80.0 %)
   E   [index]: [0, 1, 2, 3, 4]
   E   [left]:  [[2015-01-05T12:00:00.000000000, 2020-08-22T10:05:00.000000000], [2024-05-05T05:49:01.000000000, 2015-12-24T22:10:17.000000000], [1996-04-30T02:38:11.000000000], None, [1987-01-27T08:21:59.000000000, NaT]]
   E   [right]: [[2015-01-05 12:00:00, 2020-08-22 10:05:00], [2024-05-05 05:49:01, 2015-12-24 22:10:17], [1996-04-30 02:38:11], None, [1987-01-27 08:21:59, None]]
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org