Files
AE_script/test_xls.py
Alexey Barabanov 3e670d3722 Initial test commit
2025-08-11 13:38:20 +03:00

34 lines
804 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import pandas as pd
import re
from xlrd import open_workbook
INFILE='Анонсы_Старт.xls'
INFILE='Анонсы_Триумф.xls'
with open_workbook(INFILE) as wb:
chanel=wb[0][0,2].value
df=pd.read_excel(INFILE,header=1)
for i,row in df.iterrows():
title=row.at['Title']
title=re.sub(r'\(.+?\)','',title)
m=re.match(r'(?:Прямой эфир.)?\s*([^\.]+)\.\s*(.+)\.\s*([^\.]+?)\s*-\s*([^\.]+?)\s*\.',title)
if m:
#print(title)
sport,league,team_a,team_b = m.groups()
r={'date':row.at['Date'],'time':row.at['Start Time'],
'chanel':'START' if chanel=='Старт' else 'TRIUMPH',
'sport':sport,'league':league,
'team_a':team_a,'team_b':team_b}
print(r)
else:
print(title)