fix: convert NaN/NULL to None and restore record properties structure in tap.py #48
@@ -237,18 +237,15 @@ class OfstedInspectionsStream(Stream):
|
||||
|
||||
for _, row in df.iterrows():
|
||||
record = {}
|
||||
for key in self.schema["properties"].keys():
|
||||
record[key] = None
|
||||
|
||||
for field, col in col_map.items():
|
||||
val = row.get(col, None)
|
||||
if val == 'NULL':
|
||||
if pd.isna(val) or val == 'NULL':
|
||||
val = None
|
||||
record[field] = val
|
||||
|
||||
# Cast URN
|
||||
try:
|
||||
record["urn"] = int(record["urn"])
|
||||
record["urn"] = int(record.get("urn"))
|
||||
except (ValueError, KeyError, TypeError):
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user