Skip to content

Instantly share code, notes, and snippets.

@sergiolucero
Last active January 30, 2021 08:03
Show Gist options
  • Select an option

  • Save sergiolucero/9080c3561492770ce8638c3bb5d2a463 to your computer and use it in GitHub Desktop.

Select an option

Save sergiolucero/9080c3561492770ce8638c3bb5d2a463 to your computer and use it in GitHub Desktop.
descarga del padrón servel a s3
import pandas as pd
import os, time
DOWNER = 'wget https://cdn.servel.cl/padron/A%05d.pdf'
UPPER = 'aws s3 cp A%05d.pdf s3://quantcldata/CLIENTES/SERVEL/2021/'
DELETE = 'rm A%05d.pdf'
df=pd.read_excel('cut_2018_v03.xls')
comunas=df['Código Comuna 2017']
t0=time.time()
for cix, comuna in enumerate(comunas):
if cix%10==0:
print(cix,len(comunas),round(time.time()-t0,2))
for cmd in (DOWNER,UPPER,DELETE):
os.system(cmd %comuna)
@sergiolucero

Copy link
Copy Markdown
Author

Wget and maybe aws could be made quiet. Comunas to CSV avoids pandas, could also pass %05d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment