This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

27 righe
592 B

  1. "Transformer for evaluating csv.lark"
  2. from lark import Transformer
  3. class CsvTreeToPandasDict(Transformer):
  4. INT = int
  5. FLOAT = float
  6. SIGNED_FLOAT = float
  7. WORD = str
  8. NON_SEPARATOR_STRING = str
  9. def row(self, children):
  10. return children
  11. def start(self, children):
  12. data = {}
  13. header = children[0].children
  14. for heading in header:
  15. data[heading] = []
  16. for row in children[1:]:
  17. for i, element in enumerate(row):
  18. data[header[i]].append(element)
  19. return data