-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
35 lines (28 loc) · 925 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pandas as pd
from pywindsorai.client import Client
from map_converter import Map
def main():
# Fetch dataset
client = Client(api_key="your-key")
request = client.connectors(
date_from="2022-10-01",
date_to="2022-11-01",
fields=["date", "country", "source", "campaign", "clicks"],
connector="google_ads"
)
dataset = pd.DataFrame(request["data"])
# Create map
generator = Map()
# If dataset does not have latitude and longitude, find them.
dataset = generator.get_lat_long(dataset, location_column="country")
# dataset = pd.read_csv("Dataset/sample_data.csv", sep="\t")
# Create HTML map
generator.create_map(
data=dataset,
caption="Google Ads Clicks By Country (October 2022)",
normalize=True
)
# Convert map to gif.
generator.to_gif(driver_option="Chrome")
if __name__ == "__main__":
main()