cryptodatapy.transform.impute ============================= .. py:module:: cryptodatapy.transform.impute Classes ------- .. autoapisummary:: cryptodatapy.transform.impute.Impute Module Contents --------------- .. py:class:: Impute(filtered_df: pandas.DataFrame, plot: bool = False, plot_series: tuple = ('BTC', 'close')) Handles missing values. .. py:attribute:: filtered_df .. py:attribute:: plot :value: False .. py:attribute:: plot_series :value: ('BTC', 'close') .. py:attribute:: imputed_df :value: None .. py:method:: fwd_fill() -> pandas.DataFrame Imputes missing values by imputing missing values with latest non-missing values. :returns: **imputed_df** -- DataFrame MultiIndex with DatetimeIndex (level 0), ticker (level 1) and fields (cols) with imputed values using forward fill method. :rtype: pd.DataFrame - MultiIndex .. py:method:: interpolate(method: str = 'linear', order: Optional[int] = None, axis: int = 0, limit: Optional[int] = None) -> pandas.DataFrame Imputes missing values by interpolating using various methods. :param method: ‘polynomial’, ‘krogh’, ‘piecewise_polynomial’, ‘pchip’, ‘akima’, ‘cubicspline’}, default spline Interpolation method to use. :type method: str, {'linear', ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’, ‘spline’, ‘barycentric’, :param order: Order of polynomial or spline. :type order: int, optional, default None :param axis: Axis to interpolate along. :type axis: {{0 or ‘index’, 1 or ‘columns’, None}}, default None :param limit: Maximum number of consecutive NaNs to fill. Must be greater than 0. :type limit: int, optional, default None :returns: **imputed_df** -- DataFrame MultiIndex with DatetimeIndex (level 0), ticker (level 1) and fields (cols) with imputed values using interpolation method. :rtype: pd.DataFrame - MultiIndex .. py:method:: fcst(yhat_df: pandas.DataFrame) -> pandas.DataFrame Imputes missing values with forecasts from outlier detection algorithm. :param yhat_df: Multiindex dataframe with DatetimeIndex (level 0), tickers (level 1) and fields (cols) with forecasted values. :type yhat_df: pd.DataFrame - MultiIndex :returns: **imputed_df** -- DataFrame MultiIndex with DatetimeIndex (level 0), ticker (level 1) and fields (cols) with imputed values using forecasts from outlier detection method. :rtype: pd.DataFrame - MultiIndex .. py:method:: plot_imputed() -> None Plots filtered time series.