Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def replace_expiration(df):
- df['fecha_vencimiento'] = df['fecha_vencimiento'].str.replace(' de enero', '-01')
- df['fecha_vencimiento'] = df['fecha_vencimiento'].str.replace(' de febrero', '-02')
- df['fecha_vencimiento'] = df['fecha_vencimiento'].str.replace(' de marzo', '-03')
- df['fecha_vencimiento'] = df['fecha_vencimiento'].str.replace(' de abril', '-04')
- df['fecha_vencimiento'] = df['fecha_vencimiento'].str.replace(' de mayo', '-05')
- df['fecha_vencimiento'] = df['fecha_vencimiento'].str.replace(' de junio', '-06')
- df['fecha_vencimiento'] = df['fecha_vencimiento'].str.replace(' de julio', '-07')
- df['fecha_vencimiento'] = df['fecha_vencimiento'].str.replace(' de agosto', '-08')
- df['fecha_vencimiento'] = df['fecha_vencimiento'].str.replace(' de septiembre', '-09')
- df['fecha_vencimiento'] = df['fecha_vencimiento'].str.replace(' de octubre', '-10')
- df['fecha_vencimiento'] = df['fecha_vencimiento'].str.replace(' de noviembre', '-11')
- df['fecha_vencimiento'] = df['fecha_vencimiento'].str.replace(' de diciembre', '-12')
- return df
- data_c1_comp = replace_expiration(data_c1_comp) #This can be done by reference, but it prints the return and its slow
- data_c1_comp['fecha_compromiso'] = pd.to_datetime(data_c1_comp['fecha_compromiso'], format='%Y-%m-%d')
- data_c1_comp['fecha_llamada'] = pd.to_datetime(data_c1_comp['DATE'], format='%Y-%m-%d')
- data_c1_comp['fecha_vencimiento'] = pd.to_datetime(data_c1_comp['fecha_vencimiento'], format='%d-%m')
- data_c1_comp.head()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement