Пример #1
0
 def yesterday(self):
     return self[(self.time > yesterday()) & (self.time < now())]
Пример #2
0
            "end": end,
            "address": address,
            "month": start.month,
            "hour": start.hour,
            "year": start.year,
        }
        loc = {"lat": None, "lon": None, "coordinates": []}
        # here switch lon|lat
        coor = sum(
            [[
                format_latlng((x.split(",")[1], x.split(",")[0])).split(", ")
                for x in c.split()
            ] for c in coords],
            [],
        )
        if coor:
            loc["coordinates"] = coor
            loc["lat"] = coor[0][0]
            loc["lon"] = coor[0][1]
        # for data in placemark.xpath("//klm:Data", namespaces=N):
        #     cats.update(data.xpath("./@name", namespaces=N))
        d.update(loc)
        days.append(d)

df = pd.DataFrame(days)
df = df.reindex(list(d.keys()), axis=1)

yday = yesterday()
tmpl = "/home/pascal/Downloads/timeline_data-{}-{:02d}-{:02d}.csv"
df.to_csv(tmpl.format(yday.year, yday.month, yday.day))