Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
718 B
1
Indexable
Never
def data_pre_processing(data):
    # Convert the 'creation_date' and 'resolution_date' columns to datetime
    [x.lower for x in data.columns if ]
    data['created_date']=pd.to_datetime(data['created_date'])
    data['ticket_resolution_date']=pd.to_datetime(data['ticket_resolution_date'])
    data['ticket_resolution_time']=data.apply(lambda row:row['ticket_resolution_date']-row['created_date'],axis=1)
    data['ticket_resolution_time'] =data['ticket_resolution_time'].apply(lambda x: x.total_seconds() / 3600)
    data.drop(columns=['ticket_resolution_date','created_date'],axis=1 ,inplace=True)
    
    data['ticket_desc'] = data['ticket_desc'].apply(preprocess_text)
    #print(data)
    return data