C# MLContext LoadFromTextFile处理输入文件中的空值

C# MLContext LoadFromTextFile处理输入文件中的空值,c#,.net,machine-learning,ml.net,C#,.net,Machine Learning,Ml.net,我的主要代码: MLContext mlContext = new MLContext(); var str = Directory.GetCurrentDirectory(); IDataView data = mlContext.Data.LoadFromTextFile<MyRecord>(@"data.csv", separatorChar: ',', hasHeader: true); var preview = data.Preview(10); d

我的主要代码:

MLContext mlContext = new MLContext();
var str = Directory.GetCurrentDirectory();
IDataView data = mlContext.Data.LoadFromTextFile<MyRecord>(@"data.csv", separatorChar: ',', hasHeader: true);
var preview = data.Preview(10);
data.csv的内容:

ID|TimeField|
01|NULL     |
由于文件中的空值,我得到以下异常

System.FormatException: 'Parsing failed with an exception: Could not parse value NULL in line 261, column TimeField'. 
InvalidOperationException: Could not parse value NULL in line 261, column TimeField
如何优雅地处理这些异常并为返回null的条目分配默认值

System.FormatException: 'Parsing failed with an exception: Could not parse value NULL in line 261, column TimeField'. 
InvalidOperationException: Could not parse value NULL in line 261, column TimeField