Esempio n. 1
0
    def emptyStringToNone(l):
        for i, x in enumerate(l):
            if type(x) is list:
                emptyStringToNone(x)

            elif x == '':
                l[i] = None

        return l
Esempio n. 2
0
  def emptyStringToNone(l):
    for i, x in enumerate(l):
      if type(x) is list:
        emptyStringToNone(x)

      elif x == '':
        l[i] = None

    return l
Esempio n. 3
0
    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)
Esempio n. 4
0
  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)
Esempio n. 5
0
  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)