MCPcopy Create free account
hub / github.com/apache/arrow / test_simple_timestamps

Method test_simple_timestamps

python/pyarrow/tests/test_csv.py:1081–1096  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1079 }
1080
1081 def test_simple_timestamps(self):
1082 # Infer a timestamp column
1083 rows = (b"a,b,c\n"
1084 b"1970,1970-01-01 00:00:00,1970-01-01 00:00:00.123\n"
1085 b"1989,1989-07-14 01:00:00,1989-07-14 01:00:00.123456\n")
1086 table = self.read_bytes(rows)
1087 schema = pa.schema([('a', pa.int64()),
1088 ('b', pa.timestamp('s')),
1089 ('c', pa.timestamp('ns'))])
1090 assert table.schema == schema
1091 assert table.to_pydict() == {
1092 'a': [1970, 1989],
1093 'b': [datetime(1970, 1, 1), datetime(1989, 7, 14, 1)],
1094 'c': [datetime(1970, 1, 1, 0, 0, 0, 123000),
1095 datetime(1989, 7, 14, 1, 0, 0, 123456)],
1096 }
1097
1098 def test_timestamp_parsers(self):
1099 # Infer timestamps with custom parsers

Callers

nothing calls this directly

Calls 2

read_bytesMethod · 0.95
schemaMethod · 0.45

Tested by

no test coverage detected