catatom2osm.csvtools module

CSV related help functions.

catatom2osm.csvtools.csv2dict(csv_path, a_dict=None, exists=False, single=True)[fuente]

Read a dictionary from a csv file.

catatom2osm.csvtools.dict2csv(csv_path, a_dict, sort=None)[fuente]

Write a dictionary to a csv file.

Optinally sorted by key (sort=0) or value (sort=1)

catatom2osm.csvtools.filter(csv_path, *args, query=<function <lambda>>, stop=False)[fuente]

Return csv rows filtered using query.

Parámetros
  • args – aditional arguments for query function

  • query (func) – function with args row and wargs that returns a boolean deciding if each row will be included or not

  • stop (bool) – Stop at first match or get all

catatom2osm.csvtools.get_key(csv_path, key)[fuente]

Get a row given first column value.

catatom2osm.csvtools.search(csv_path, *args, query=<function <lambda>>)[fuente]

Return first matched row in csv.

Parámetros
  • args – aditional arguments for query function

  • query (func) – function with args row and wargs that returns a boolean deciding if each row will be included or not

catatom2osm.csvtools.startswith(csv_path, key)[fuente]

Get rows which first column starts with key.