Skip to content

Instantly share code, notes, and snippets.

@sandrovw64
Created May 16, 2023 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandrovw64/f2c209419220a998bbd81d8296dc8f1e to your computer and use it in GitHub Desktop.
Save sandrovw64/f2c209419220a998bbd81d8296dc8f1e to your computer and use it in GitHub Desktop.
Get CSV data from URL using Pandas
import pandas as pd
years = [2022, 2023]
months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
account_token = '52106c49-445d-44b4-b88b-1b9a636a1ab2'
for year in years:
for month in months:
month_string = str(month).zfill(2)
url = f'https://mercadoradar-datashare.s3.us-east-2.amazonaws.com/{year}/{month_string}/01/{account_token}.csv'
df = pd.read_csv(url)
df.to_csv(f'./{year}_{month_string}_MERCADORADAR.csv')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment