- Timestamp:
- 09/16/11 08:28:12 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/TableFileParser.cs
r6742 r6776 98 98 } 99 99 100 var columnType = types.GroupBy(v => v).OrderBy(v => v ).Last().Key;100 var columnType = types.GroupBy(v => v).OrderBy(v => v.Count()).Last().Key; 101 101 if (columnType == typeof(double)) values.Add(new List<double>()); 102 102 else if (columnType == typeof(DateTime)) values.Add(new List<DateTime>()); … … 111 111 int columnIndex = 0; 112 112 foreach (object element in row) { 113 //handle missing values with default values 114 if (element as string == string.Empty) { 115 if (values[columnIndex] is List<double>) values[columnIndex].Add(double.NaN); 116 else if (values[columnIndex] is List<DateTime>) values[columnIndex].Add(DateTime.MinValue); 117 else if (values[columnIndex] is List<string>) values[columnIndex].Add(string.Empty); 118 else throw new InvalidOperationException(); 119 } else values[columnIndex].Add(element); 113 if (values[columnIndex] is List<double> && !(element is double)) 114 values[columnIndex].Add(double.NaN); 115 else if (values[columnIndex] is List<DateTime> && !(element is DateTime)) 116 values[columnIndex].Add(DateTime.MinValue); 117 else if (values[columnIndex] is List<string> && !(element is string)) 118 values[columnIndex].Add(string.Empty); 119 else 120 values[columnIndex].Add(element); 120 121 columnIndex++; 121 122 } … … 296 297 token.type = TokenTypeEnum.Double; 297 298 return token; 298 } else if (DateTime.TryParse(strToken, out token.dateTimeValue)) {299 } else if (DateTime.TryParse(strToken, dateTimeFormatInfo, DateTimeStyles.None, out token.dateTimeValue)) { 299 300 token.type = TokenTypeEnum.DateTime; 300 301 return token;
Note: See TracChangeset
for help on using the changeset viewer.