data_utils module¶
- data_utils.activity_colors(list_act=None, palette='gist_earth')[source]¶
Match each activity from list to a color from the input palette. Useful to keep consistent colors across visualizations
- data_utils.bootstrap_mean(data, num_samples, sample_size=None)[source]¶
Compute the bootstrap mean of an array.
Parameters: - data: Input array of data. - num_samples: Number of bootstrap samples to generate. - sample_size: Size of each bootstrap sample. If None, it will be set to the size of the input data.
Returns: - bootstrap_means: Array containing the bootstrap means.
- data_utils.compute_distances_from_tmat(tmat)[source]¶
Computes a distance matrix using the locations of the provided travel time matrix
- data_utils.cplex_to_df(w, x, d, tt, car_avail, mode_travel, keys, act_id, location, minutes=False)[source]¶
Stores a CPLEX solution into a Pandas dataframe.
- data_utils.discretize_sched(schedule, block_size=0.5)[source]¶
Returns a 24h schedule discretized in blocks of size (duration) n Block size is expressed in hours
//If no schedule is passed, then a random discretized schedule is generated, otherwise, the passed schedule is discretized accordingly (existing activities are broken down into blocks)//
If a list of activities (list_act) is passed, then all the activities of the list are scheduled. Otherwise, schedules are generated randomly from the default list of activities.
- data_utils.plot_mode(df, modes=None)[source]¶
Plots modes used in trip legs of a given schedule (df). modes = list of possible modes