Skip to content

Commit 75d6018

Browse files
Fix date parsing issue in arrow_parser_wrapper
1 parent 881f523 commit 75d6018

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/io/parsers/arrow_parser_wrapper.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,18 @@ def read(self) -> DataFrame:
274274

275275
dtype_backend = self.kwds["dtype_backend"]
276276

277+
# Handle missing date values by checking for timestamp columns
278+
for i, field in enumerate(table.schema):
279+
if pa.types.is_timestamp(field.type): # Check if the column is a timestamp
280+
# Convert to a Pandas Series
281+
column = table.column(i).to_pandas()
282+
283+
# Replace missing values with NaT
284+
column.fillna(pd.NaT, inplace=True)
285+
286+
# Update the column back to the table
287+
table = table.set_column(i, field.name, pa.array(column))
288+
277289
# Convert all pa.null() cols -> float64 (non nullable)
278290
# else Int64 (nullable case, see below)
279291
if dtype_backend is lib.no_default:

0 commit comments

Comments
 (0)