1

是否可以在摄入目录中包含“转换器”kwarg?我有一堆带有“N”和“S”后缀的纬度/经度坐标的csv文件。类似于以下内容:

sources:
  Source1:
    description: A Description
    driver: csv
    args:
      urlpath: [path_to_file.csv]
      csv_kwargs:
        converters: {'LATITUDE N/S':lambda x: float(x[0:-1])}

错误

ParserError: while parsing a flow mapping
  in "<unicode string>", line 50, column 21:
            converters: {'LATITUDE N/S':lambda x:float(x ... 
                            ^
    expected ',' or '}', but got '['
      in "<unicode string>", line 50, column 53:
         ... {'LATITUDE N/S':lambda x:float(x[0:-1])}

本质上,如何在目录中嵌入一个简单的 python lambda 函数?

谢谢!

4

0 回答 0