hsaest's picture
Upload folder using huggingface_hub
6159f52 verified
raw
history blame
1.28 kB
# import os
# from tools.flights.apis import Flights
# import re
# import sys
# import os
# flight = Flights('/home/xj/toolAugEnv/code/toolConstraint/database/flights/clean_Flights_2022.csv')
# data = flight.run('Austin', 'Seattle', '2022-03-01')
# # print(len(data))
# print(data)
from tools.flights.apis import Flights
import pandas as pd
import sys
import os
# results = self.data[self.data["OriginCityName"] == origin]
# results = results[results["DestCityName"] == destination]
sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "..")))
os.chdir(os.path.dirname(os.path.abspath(__file__)))
unique_cities = list(Flights(path="..//home/user/app/database/flights/clean_Flights_2022.csv").data['OriginCityName'].unique()) + list(Flights(path="..//home/user/app/database/flights/clean_Flights_2022.csv").data['DestCityName'].unique())
df = Flights(path="..//home/user/app/database/flights/clean_Flights_2022.csv").data
print(len(df))
citySet = open('..//home/user/app/database/background/citySet.txt','r').read().split('\n')
cnt = 0
for city in unique_cities:
if city not in citySet:
df = df[(df['OriginCityName'] != city) & (df['DestCityName'] != city)]
print(len(df))
df.to_csv('..//home/user/app/database/flights/clean_Flights_2022.csv', index=False)