def emptyStringToNone(l): for i, x in enumerate(l): if type(x) is list: emptyStringToNone(x) elif x == '': l[i] = None return l
def __fromCSV(self, data, source, convert): if len(data) == 0: return None labels = data.pop(0) n = len(data) if n == 0: return {l: [] for l in labels} emptyStringToNone(data) return self.__DictOfColumns(labels, data, source, convert)
def __fromCSV(self, data, source, convert, oldLabels): if len(data) == 0: return None labels = data.pop(0) if isinstance(oldLabels, set): oldLabels.clear() oldLabels.update(labels) n = len(data) if n == 0: return dict((l, []) for l in labels) emptyStringToNone(data) return self.__DictOfColumns(labels, data, source, convert)