Skip to content

Commit 040f4df

Browse files
committed
Null guard on parse_string to prevent accidentical coercion of pd.NA to '<NA>'
1 parent 15b6afb commit 040f4df

5 files changed

Lines changed: 10 additions & 3 deletions

File tree

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
- 1.2.8: Null guard on `parse_string` to prevent accidentical coercion of `pd.NA` to `'<NA>'`.
12
- 1.2.7: Fixed brittle reference to `WHYQD_SPILLWAY` temporary directory to be more robust.
23
- 1.2.6: Fixed brittle reference to `WHYQD_SPILLWAY` temporary directory to be more robust.
34
- 1.2.5: Fixed date parser error when date is an int POSIX timestamp.

docs/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ tags: wrangling, crosswalks, versions
88
---
99
# Change log
1010

11+
## Version 1.2.8 (2026-04-19)
12+
13+
- Null guard on `parse_string` to prevent accidentical coercion of `pd.NA` to `'<NA>'`.
14+
1115
## Version 1.2.5 (2025-09-30)
1216

1317
- Fixed date parser error when date is an int POSIX timestamp.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "whyqd"
3-
version = "1.2.7"
3+
version = "1.2.8"
44
description = "data wrangling simplicity, complete audit transparency, and at speed"
55
authors = ["Gavin Chait <gchait@whythawk.com>"]
66
license = "BSD-3-Clause"

whyqd/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.7
1+
1.2.8

whyqd/parsers/datasource.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,9 @@ def parse_int(self, x: str | int | float) -> np.nan | int:
803803
except ValueError:
804804
return None
805805

806-
def parse_string(self, x: str) -> None | str:
806+
def parse_string(self, x: str | None) -> str | None:
807+
if _pd.isna(x):
808+
return None
807809
x = str(x).replace("\n", " ").replace("\r", "").replace("\t", "").replace("\\", "").strip()
808810
x = " ".join(str(x).split())
809811
if x and x[0] == "'":

0 commit comments

Comments
 (0)