From 16c21b59257d045def3be12112bb8b26894fdd64 Mon Sep 17 00:00:00 2001 From: Conrad Schloer Date: Fri, 22 Nov 2019 17:32:55 +0100 Subject: [PATCH] Add preserve_missing_values parameter to cast_value function --- tableschema/field.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tableschema/field.py b/tableschema/field.py index d400bee..448982e 100644 --- a/tableschema/field.py +++ b/tableschema/field.py @@ -79,12 +79,15 @@ def descriptor(self): """ return self.__descriptor - def cast_value(self, value, constraints=True): + def cast_value(self, value, constraints=True, preserve_missing_values=False): """https://github.com/frictionlessdata/tableschema-py#field """ # Null value if value in self.__missing_values: + # If missing_values should be preserved without being cast + if preserve_missing_values: + return value value = None # Cast value