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

Method test_simple_timestamps

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

Source from the content-addressed store, hash-verified

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