def interpolate(times, voltages, time_interp_indices, voltage_interp_indices):
    """ Uses linear interpolation to convert non-float or missing entries to
    workable values for time and voltage.

    :param times: A list of float-converted time data
    :param voltages: A list of float-converted voltage data
    :param time_interp_indices: List indices where time data should be
    replaced with an interpolated value
    :param voltage_interp_indices: List indices where voltage data should be
    replaced with an interpolated value
    :return: Lists of properly interpolated (if applicable) time and voltage
    data
    """
    new_times = []
    new_voltages = []
    for index in range(len(times)):
        if index == 0 or index == len(times) - 1:
            if index in time_interp_indices or index in voltage_interp_indices:
                continue
            else:
                new_times.append(times[index])
                new_voltages.append(voltages[index])
        else:
            if index in time_interp_indices:
                # Interpolates times data
                new_times.append(times[index - 1] + (times[index + 1] -
                                 times[index - 1]) * (voltages[index] -
                                 voltages[index - 1]) / (voltages[index + 1] -
                                                         voltages[index - 1]))
            else:
                new_times.append(times[index])
            if index in voltage_interp_indices:
                # Interpolates voltages data
                new_voltages.append(voltages[index-1] + (times[index] -
                                    times[index-1]) * (voltages[index+1] -
                                    voltages[index-1]) / (times[index+1] -
                                    times[index-1]))
            else:
                new_voltages.append(voltages[index])
    return new_times, new_voltages