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

Method test_simple_timestamps

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

Source from the content-addressed store, hash-verified

1063 }
1064
1065 def test_simple_timestamps(self):
1066 # Infer a timestamp column
1067 rows = (b"a,b,c\n"
1068 b"1970,1970-01-01 00:00:00,1970-01-01 00:00:00.123\n"
1069 b"1989,1989-07-14 01:00:00,1989-07-14 01:00:00.123456\n")
1070 table = self.read_bytes(rows)
1071 schema = pa.schema([('a', pa.int64()),
1072 ('b', pa.timestamp('s')),
1073 ('c', pa.timestamp('ns'))])
1074 assert table.schema == schema
1075 assert table.to_pydict() == {
1076 'a': [1970, 1989],
1077 'b': [datetime(1970, 1, 1), datetime(1989, 7, 14, 1)],
1078 'c': [datetime(1970, 1, 1, 0, 0, 0, 123000),
1079 datetime(1989, 7, 14, 1, 0, 0, 123456)],
1080 }
1081
1082 def test_timestamp_parsers(self):
1083 # 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