Skip to content

[C++] Unable to read date64 or date32 in specific format from CSV #28303

Description

@asfimport

when importing csv data with dates in the format "%d-%b-%y" or "%d-%b-%Y" an error is given in conversion:

example:

import pyarrow as pa
from pyarrow import csv 

data = b"a,b\n1,15-OCT-15\n2,18-JUN-90\n"
tp = ["%d-%b-%y"]

try:
    schema_d64 = pa.schema([pa.field("a", pa.int64()), pa.field("b", pa.date64())])
    co_d64 = csv.ConvertOptions(timestamp_parsers=tp, column_types=schema_d64)
    a_d64 = csv.read_csv(pa.py_buffer(data), convert_options=co_d64)
except Exception as e:
    print(e)
try:
    schema_d32 = pa.schema([pa.field("a", pa.int64()), pa.field("b", pa.date32())])
    co_d32 = csv.ConvertOptions(timestamp_parsers=tp, column_types=schema_d32)
    a_d32 = csv.read_csv(pa.py_buffer(data), convert_options=co_d32)
except Exception as e:
    print(e)

 

Reporter: Stephen Bias

Related issues:

Note: This issue was originally created as ARROW-12539. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions