Last active
January 30, 2021 08:03
-
-
Save sergiolucero/9080c3561492770ce8638c3bb5d2a463 to your computer and use it in GitHub Desktop.
descarga del padrón servel a s3
This file contains hidden or 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 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) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wget and maybe aws could be made quiet. Comunas to CSV avoids pandas, could also pass %05d.