<jupyter_start><jupyter_text>ABPC<jupyter_code>abpc = pd.read_csv('D:\\Usuarios\\mdbrenes\\Documents\\Projects\\airport\\Documentos TT\\Datos de entrada\\ABPC\\abpc_2018-01-01.csv', delimiter=';', names=['ID','FLIGHTID','LECTOR ID','CHECK DATE','STATUS','REASON','CHECKIN SEQUENCE NUMBER','PNR','DEPARTURE FLIGHT DESTINATION AIRPORT IATA CODE','DEPARTURE FLIGHT AIRLINE IATA CODE','DEPARTURE FLIGHT NUMBER','DEPARTURE FLIGHT SOBT'])
abpc.info()
abpc.head()
abpc.loc[abpc['STATUS']!=0]['REASON'].values.sum()
abpc.loc[abpc['STATUS']==0]['REASON'].values
#abpc['STATUS'].loc[abpc['STATUS']!='PASSED'].values
abpc['STATUS'].unique()
abpc['REASON'].unique()
abpc['CHECK DATE'].isnull().sum()<jupyter_output><empty_output><jupyter_text>Preprocesamiento de datos<jupyter_code># Encode Categorycal Variables

# STATUS

labelencoder_X = LabelEncoder()
abpc.iloc[:, 4] = labelencoder_X.fit_transform(abpc.iloc[:, 4])

# 0 PASSED
# 1 NOT PASSED
# Dates to Datetime

# Check-Date
date_check = pd.to_datetime(abpc['CHECK DATE'],format = '%d/%m/%Y %H:%M')
abpc['CHECK DATE']=date_check.map(lambda x: x.strftime('%Y-%m-%d %H:%M:%S'))

# Departure Date
date_dep = pd.to_datetime(abpc['DEPARTURE FLIGHT SOBT'],format = '%d/%m/%Y %H:%M')
abpc['DEPARTURE FLIGHT SOBT']=date_dep.map(lambda x: x.strftime('%Y-%m-%d %H:%M:%S'))

# Adding a variable: Dwell Time (Check - Departure)

# Dwell Time
dwell_time = date_dep - date_check
abpc['DWELL TIME'] = dwell_time.map(lambda x: x.total_seconds()/3600)
abpc['DWELL HOUR'] = abpc['DWELL TIME'].map(lambda x: int(x))

abpc['DWELL MIN'] = abpc['DWELL TIME'].map(lambda x: (x-int(x))*60)

abpc.reset_index(inplace=True,drop='True')

dwtime = []
counts = []
for dwt in abpc['DWELL TIME'].loc[pd.isna(abpc['REASON'])].unique(): # Cogemos los de razones nulas
    num = list(abpc['DWELL TIME']).count(dwt)
    dwtime.append(dwt)
    counts.append(num)
plt.scatter(dwtime,counts)
abpc.loc[abpc['DWELL HOUR']<0]<jupyter_output><empty_output><jupyter_text>TAREAS Variables interesantesJOINS--> FLIGHTID, CODIGOSTransformacionesSTATUShttps://machinelearningmastery.com/how-to-one-hot-encode-sequence-data-in-python/ ¿Volumen de pasajeros en el tiempo? nºpassajeros vs. check dateCalcular tiempo waiting time . nº passajeros vs. wainting time y clusterización por hora de vuelo y clase de pasajero (histograma)<jupyter_code>flight = pd.read_csv('D:\\Usuarios\\mdbrenes\\Documents\\Projects\\airport\\Documentos TT\\Datos de entrada\\FlightList\\FlightList_2018-01-01.csv', delimiter=';', header = 0)
flight.head()
# ID / ESTADO

#flight.loc[flight['SOBT']=='01/01/2018 16:40'].iloc[:,0:12]

#flight.loc[flight['SOBT']=='01/01/2018 06:40'].iloc[:,0:12]
flight.loc[flight['DEP ID']=='A3926'].iloc[:,0:12]

# RETRASO

#flight.loc[flight['SOBT']=='01/01/2018 16:40'].iloc[:,12:18]

flight.loc[flight['DEP ID']=='A3926'].iloc[:,12:18]
# Salir del parking

flight.loc[flight['SOBT']=='02/01/2018 05:30'].iloc[:,25:29]

#flight.loc[flight['DEP ID']=='A3926'].iloc[:,25:29]
flight.columns
flight.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 260 entries, 0 to 259
Data columns (total 55 columns):
REGISTRATION             196 non-null object
ARR ID                   260 non-null object
ARR C/S                  200 non-null object
DEP ID                   260 non-null object
DEP C/S                  165 non-null object
A/C Type ICAO            201 non-null object
A/C Type IATA            260 non-null object
ADEP IATA                259 non-null object
ADEP ICAO                200 non-null object
ADES IATA                259 non-null object
ADES ICAO                200 non-null object
STATUS                   260 non-null object
DCD1                     7 non-null object
DCD2                     2 non-null object
DTD1                     7 non-null float64
DTD2                     3 non-null float64
SLDT                     260 non-null object
ELDT                     200 non-null object
TLDT                     0 non-null float64
ALDT                     104 non-null object
SI[...]<jupyter_text>INVESTIGAR POR QUÉ HAY MUY POCAS VARIABLES DE ALGUNAS VARIABLES. ¿CUANDO APLICA USAR UNA U OTRA?<jupyter_code>flight_2 = pd.read_csv('D:\\Usuarios\\mdbrenes\\Documents\\Projects\\airport\\Documentos TT\\Datos de entrada\\FlightList\\FlightList_2018-01-02.csv', delimiter=';', header = 0)
# Salir del parking

flight_2.loc[flight_2['DEP ID']=='A3926'].iloc[:,25:29]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16091954022988506, 'fraction_numerical': 0.04597701149425287, 'mean_word_length': 3.8082340195016253, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '612072', 'license': 'RSA-MD', 'n_tokens_mistral': 1824, 'n_tokens_neox': 1627, 'n_words': 323, 'path': 'airport/airport.ipynb', 'repo_name': 'joanvelro/repo_A', 'size': '4437'}