def _interpolate_df_col(df, x=None, y=None, new_x=None, dx=10.0,
                        number_of_points=None, direction=1, **kwargs):
        """Interpolate a column based on another column.

        Args:
            df: DataFrame with the (cycle) data.
            x: Column name for the x-value (defaults to the step-time column).
            y: Column name for the y-value (defaults to the voltage column).
            new_x (numpy array or None): Interpolate using these new x-values
                instead of generating x-values based on dx or number_of_points.
            dx: step-value (defaults to 10.0)
            number_of_points: number of points for interpolated values (use
                instead of dx and overrides dx if given).
            direction (-1,1): if direction is negetive, then invert the
                x-values before interpolating.
            **kwargs: arguments passed to scipy.interpolate.interp1d

        Returns: DataFrame with interpolated y-values based on given or
            generated x-values.

        """

        if x is None:
            x = df.columns[0]
        if y is None:
            y = df.columns[1]

        xs = df[x].values
        ys = df[y].values

        if direction > 0:
            x_min = xs.min()
            x_max = xs.max()
        else:
            x_max = xs.min()
            x_min = xs.max()
            dx = -dx

        bounds_error = kwargs.pop("bounds_error", False)
        f = interpolate.interp1d(xs, ys, bounds_error=bounds_error, **kwargs)
        if new_x is None:
            if number_of_points:
                new_x = np.linspace(x_min, x_max, number_of_points)
            else:
                new_x = np.arange(x_min, x_max, dx)

        new_y = f(new_x)

        new_df = pd.DataFrame(
            {x: new_x, y: new_y}
        )

        return new_df
Interpolate a column based on another column.

        Args:
            df: DataFrame with the (cycle) data.
            x: Column name for the x-value (defaults to the step-time column).
            y: Column name for the y-value (defaults to the voltage column).
            new_x (numpy array or None): Interpolate using these new x-values
                instead of generating x-values based on dx or number_of_points.
            dx: step-value (defaults to 10.0)
            number_of_points: number of points for interpolated values (use
                instead of dx and overrides dx if given).
            direction (-1,1): if direction is negetive, then invert the
                x-values before interpolating.
            **kwargs: arguments passed to scipy.interpolate.interp1d

        Returns: DataFrame with interpolated y-values based on given or
            generated x-values.