Skip to content

Instantly share code, notes, and snippets.

@vallettea
Created June 26, 2014 14:07
Show Gist options
  • Select an option

  • Save vallettea/89736788abee30bb8b71 to your computer and use it in GitHub Desktop.

Select an option

Save vallettea/89736788abee30bb8b71 to your computer and use it in GitHub Desktop.
script to clean SDK log
locations = filter(lambda line: line.split("|")[-1] == "loc-bg\r\n", open("log.csv"))
def extract(line):
items = line.split(",")
timestamp = items[0].split("|")[0]
lon = items[1]
lat = items[2]
return ";".join([timestamp, lon, lat])
locations = map(extract, locations)
out = open("out.csv","w")
out.write("ts;lon;lat\n")
out.write("\n".join(locations))
out.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment