procedures:infobip_billing_whatsapp.zip
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| procedures:infobip_billing_whatsapp.zip [2025/05/28 09:42] – created luca.bottoli | procedures:infobip_billing_whatsapp.zip [2025/05/28 09:56] (current) – luca.bottoli | ||
|---|---|---|---|
| Line 27: | Line 27: | ||
| file_path = os.path.join(folder_path, | file_path = os.path.join(folder_path, | ||
| os.remove(file_path) | os.remove(file_path) | ||
| + | </ | ||
| + | < | ||
| + | # ignoro warning di openpyxl | ||
| + | warnings.filterwarnings(" | ||
| + | |||
| + | df_list = [] | ||
| + | |||
| + | # scorro tutti i file .xlsx nella cartella | ||
| + | for filename in os.listdir(folder_path): | ||
| + | if filename.endswith(' | ||
| + | file_path = os.path.join(folder_path, | ||
| + | try: | ||
| + | df = pd.read_excel(file_path, | ||
| + | df_list.append(df) | ||
| + | except Exception as e: | ||
| + | print(f" | ||
| + | |||
| + | # combino tutti i dataframe in uno solo | ||
| + | df = pd.concat(df_list, | ||
| + | df[' | ||
| + | </ | ||
| + | < | ||
| + | #creo il dataframe | ||
| + | df = df[[' | ||
| + | df[' | ||
| + | df[' | ||
| + | </ | ||
| + | < | ||
| + | #associo ogni apikey al cliente | ||
| + | api_keys = { | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | < | ||
| + | #creo i dataframes per ogni apikey | ||
| + | numbers = df[" | ||
| + | for number in numbers: | ||
| + | df[' | ||
| + | dfs = [group for _, group in df.groupby(' | ||
| + | </ | ||
| + | < | ||
| + | #faccio i conti e stampo | ||
| + | for d in dfs: | ||
| + | print(" | ||
| + | print(" | ||
| + | print(" | ||
| + | print(" | ||
| + | print(" | ||
| + | print(" | ||
| + | print(" | ||
| + | print(" | ||
| </ | </ | ||
procedures/infobip_billing_whatsapp.zip.txt · Last modified: by luca.bottoli
