Update to handle two digit dates in filenames as they are published
This commit is contained in:
parent
38053cf161
commit
9439a4e251
@ -25,7 +25,9 @@ def extract_tables(file_path):
|
|||||||
pis_and_headcode = match_pis_and_headcode(data)
|
pis_and_headcode = match_pis_and_headcode(data)
|
||||||
if pis_and_headcode:
|
if pis_and_headcode:
|
||||||
pis_and_headcode['source_file'] = file_path
|
pis_and_headcode['source_file'] = file_path
|
||||||
pis_and_headcode['date'] = datetime.strptime(file_path.split('_')[0], "%Y%m%d")
|
current_year = datetime.now().year
|
||||||
|
date_string_with_year = f"{current_year}{datetime.strptime(file_path.split[' '][0])}"
|
||||||
|
pis_and_headcode['date'] = datetime.strptime(date_string_with_year, "%Y%m%d")
|
||||||
pis_info.append(pis_and_headcode)
|
pis_info.append(pis_and_headcode)
|
||||||
|
|
||||||
return(pis_info)
|
return(pis_info)
|
||||||
|
Reference in New Issue
Block a user