Created
February 22, 2024 01:52
-
-
Save ovo/f82126e1321c83d0a2b18950aaecb2ce to your computer and use it in GitHub Desktop.
python script to export stores to a csv that can be used as GIS data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import pandas as pd | |
# Coordinates for Ames, Iowa | |
LAT = "42.030781" | |
LONG = "-93.631913" | |
def convert_data(lat, long): | |
# Store finder API URL | |
url = f"https://us.zyn.com/find-a-store/GetStores/?lat={lat}&lng={long}" | |
r = requests.get(url) | |
data = r.json() | |
df = pd.DataFrame(data["Data"]) | |
df.to_csv("zyn_data.csv", index=False) | |
if __name__ == "__main__": | |
convert_data(LAT, LONG) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment