latecomers/devloop/serialize.py

26 lines
541 B
Python
Raw Permalink Normal View History

2022-08-24 12:43:32 +02:00
# -*- encoding: utf-8 -*-
2022-08-25 21:35:37 +02:00
import pandas as pd
2022-08-24 12:43:32 +02:00
from latecomers.parse import find_table, get_details
from latecomers.serializer import to_excel
2024-02-17 16:33:52 +01:00
with open("./devloop/sample3.html") as f:
2022-08-24 12:43:32 +02:00
content = f.read()
flights = find_table(content)
data = []
for f in flights:
2024-02-17 16:33:52 +01:00
data.append(get_details(f))
2022-08-24 12:43:32 +02:00
print(to_excel(data))
2022-08-25 21:35:37 +02:00
2024-02-17 16:33:52 +01:00
colonne = {
"th_arrival": "Arrivo teorico",
"real_arrival": "Arrivo reale",
"code": "Codice volo",
"origin": "Aeroporto di partenza",
"status": "Stato",
}
2022-08-25 21:35:37 +02:00
df = pd.DataFrame(data, columns=colonne)