def parse_header(self, l_data):
'''
Format the list of the header passe and return a dictionary
:param l_data: list. list with the elements of the parsed row
'''
d_rtn = {}
# Name of file
d_rtn['name_of_file'] = l_data[1]
# Initial date of file
d_rtn['initial_date'] = pd.to_datetime(l_data[2], format='%Y-%m-%d')
d_rtn['initial_date'] = d_rtn['initial_date'].date()
# End date of file
d_rtn['end_date'] = pd.to_datetime(l_data[3], format='%Y-%m-%d')
d_rtn['end_date'] = d_rtn['end_date'].date()
# Contain the total of lines when the file Trailer record
d_rtn['total_of_lines'] = int(l_data[4])
return d_rtn
评论列表
文章目录