How to use the prophet.data.PandasDataGenerator function in prophet

To help you get started, we’ve selected a few prophet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Emsu / prophet / prophet / data.py View on Github external
symbols_data[symbol] = symbol_data

        symbols_panel = pd.concat(symbols_data).to_panel()
        symbols_panel = symbols_panel.swapaxes('minor', 'major')
        if symbols_panel.empty:
            ProphetException("No data for the range specified:"
                             " %s to %s" % (data_start, end))

        symbols_panel = symbols_panel.fillna(method='ffill')
        symbols_panel = symbols_panel.fillna(method='bfill')
        symbols_panel = symbols_panel.fillna(1.0)
        return symbols_panel.loc[:, ((symbols_panel.major_axis >= data_start)
                                     & (symbols_panel.major_axis <= end))]


class YahooCloseData(PandasDataGenerator):
    name = 'prices'

    def __init__(self, cache_path=None, data_path=None):
        super(YahooCloseData, self).__init__(cache_path=cache_path,
                                             data_path=data_path)

    def run(self,
            data,
            symbols,
            start=datetime(2007, 1, 1),
            end=None,
            lookback=0):
        if not end:
            end = datetime.now()

        symbols_data = super(YahooCloseData, self).run(
github Emsu / prophet / prophet / data.py View on Github external
data,
            symbols,
            start=datetime(2007, 1, 1),
            end=None,
            lookback=0):
        if not end:
            end = datetime.now()

        symbols_data = super(YahooCloseData, self).run(
            data=data, symbols=symbols, start=start,
            end=end, lookback=lookback, source="yahoo")

        return symbols_data['Adj Close']


class YahooVolumeData(PandasDataGenerator):
    name = 'volume'

    def run(self,
            data,
            symbols,
            start=datetime(2007, 1, 1),
            end=None,
            lookback=0):
        if not end:
            end = datetime.now()

        symbols_data = super(YahooVolumeData, self).run(
            data=data, symbols=symbols, start=start,
            end=end, lookback=lookback, source="yahoo")

        return symbols_data['Volume']
github Emsu / prophet / prophet / data.py View on Github external
def __init__(self, cache_path=None, data_path=None):
        super(PandasDataGenerator, self).__init__(cache_path=cache_path,
                                                  data_path=data_path)
github Emsu / prophet / prophet / generators.py View on Github external
from datetime import datetime
from prophet.data import PandasDataGenerator

class YahooData(PandasDataGenerator):

    def __init__(self, column, name):
        super(YahooData, self).__init__()
        self._column = column
        self.name = name

    def run(self,
            data,
            symbols,
            start=datetime(2007, 1, 1),
            end=None,
            lookback=0):
        if not end:
            end = datetime.now()

        symbols_data = super(YahooData, self).run(