@@ -230,12 +230,14 @@ def ICA(filepath):
230230 results .core_file_location ,
231231 usecols = taxonomic_columns + geographic_columns + temporal_columns ,
232232 low_memory = False ,
233+ keep_default_na = False
233234 )
234235 except Exception as e :
235236 logger .debug (f"ERROR - { e } " )
236237 df = results .pd_read (
237238 results .core_file_location ,
238239 low_memory = False ,
240+ keep_default_na = False
239241 )
240242 missing_columns = [
241243 col
@@ -568,7 +570,7 @@ def safe_date(date):
568570
569571 # Porcentaje de años validos
570572 try :
571- dates ["year" ] = dates . date . str [: 4 ]. astype ( "Int64" )
573+ dates ["year" ] = df [ df . year . notnull ()]. copy ( )
572574 percentaje_years = (
573575 sum ((dates .year >= 0 ) & (dates .year <= datetime .date .today ().year ))
574576 / total_data
@@ -580,7 +582,7 @@ def safe_date(date):
580582
581583 # Porcentaje de meses validos
582584 try :
583- dates ["month" ] = dates . date . str [ 5 : 7 ]. astype ( "Int64" )
585+ dates ["month" ] = df [ df . month . notnull ()]. copy ( )
584586 percentaje_months = (
585587 sum ((dates .month >= 1 ) & (dates .month <= 12 )) / total_data * 100
586588 )
@@ -590,7 +592,7 @@ def safe_date(date):
590592
591593 # Porcentaje de días validos
592594 try :
593- dates ["day" ] = dates . date . str [ 8 : 10 ]. astype ( "Int64" )
595+ dates ["day" ] = df [ df . day . notnull ()]. copy ( )
594596 percentaje_days = sum ((dates .day >= 1 ) & (dates .day <= 31 )) / total_data * 100
595597 except Exception as e :
596598 logger .debug (f"ERROR day - { e } " )
0 commit comments