Project Details

macros.py funtion oportunidad()

June 29th 2023

"Using the datetime library, I get the current date in the format ""yyyy-mm-dd"". The path of (""Pendientes3.xlsx"") is reused and read into a DataFrame, checking for the following business rules: if the value in the ""Plan Description"" column is ""COLSANITAS DENTAL PLAN"" and if the number of days in the ""Days"" column is less than or equal to 2. In such a case, it returns ""TIMELY"". If the ""PENDING/MEETINGS/AHC"" column has the value ""AHC"", it returns ""TIMELY"" if the number of days in the ""Days"" column is greater than 3, otherwise, it returns ""TIMELY"". If the ""PENDING/MEETINGS/AHC"" column has the value ""MEETINGS"", it returns ""INOPPORTUNE"" if the number of days in the ""Days"" column is greater than or equal to 11, otherwise, it returns ""TIMELY"". If the ""PENDING/BOARDING/AHC"" column has the value ""PENDING"", it returns ""UNTIMELY"" if the number of days in the ""Days"" column is greater than 1, otherwise, it returns ""TIMELY"". In any other case, return 'None'. This function is then applied to the relevant columns of the 'df_pend3' DataFrame using the 'apply' method. The result is stored in a new column called ""Opportunity"". Finally, the resulting DataFrame is saved to a CSV file in the path specified by 'ruta_pendtxt'. Finally, the function returns a value of 2 if executed successfully. Otherwise, it returns the error line along with an explanatory message of the error." librarys: sys, pandas, datetime, os, openpyxl

macros.py funtion oportunidad()