-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
28 lines (21 loc) · 812 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import dash
import pandas as pd
import os
from utils import modifier
app = dash.Dash(__name__, suppress_callback_exceptions=True)
server = app.server
# Handling DataFrame
df = pd.read_csv(os.path.join(os.getcwd(), 'data', 'data-reduced.csv'))
airports = pd.read_csv(os.path.join(os.getcwd(), 'data', 'airports.csv'))
# Filter DataFrame
df = modifier.clean_df(df)
# Extending controls
destinations = pd.unique(df['Dest'].values.ravel())
origins = pd.unique(df['Origin'].values.ravel())
carriers = pd.unique(df['UniqueCarrier'].values.ravel())
destinations.sort()
origins.sort()
carriers.sort()
DESTINATIONS = list(map(lambda x: { 'label': x, 'value': x }, destinations))
ORIGINS = list(map(lambda x: { 'label': x, 'value': x }, origins))
CARRIERS = list(map(lambda x: { 'label': x, 'value': x }, carriers))