How to use the fbprophet.make_holidays.get_holiday_names function in fbprophet

To help you get started, we’ve selected a few fbprophet 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 facebook / prophet / python / fbprophet / forecaster.py View on Github external
'extra_regressors_multiplicative', 'multiplicative_terms',
        ]
        rn_l = [n + '_lower' for n in reserved_names]
        rn_u = [n + '_upper' for n in reserved_names]
        reserved_names.extend(rn_l)
        reserved_names.extend(rn_u)
        reserved_names.extend([
            'ds', 'y', 'cap', 'floor', 'y_scaled', 'cap_scaled'])
        if name in reserved_names:
            raise ValueError('Name "{}" is reserved.'.format(name))
        if (check_holidays and self.holidays is not None and
                name in self.holidays['holiday'].unique()):
            raise ValueError(
                'Name "{}" already used for a holiday.'.format(name))
        if (check_holidays and self.country_holidays is not None and
                name in get_holiday_names(self.country_holidays)):
            raise ValueError(
                'Name "{}" is a holiday name in {}.'.format(name, self.country_holidays))
        if check_seasonalities and name in self.seasonalities:
            raise ValueError(
                'Name "{}" already used for a seasonality.'.format(name))
        if check_regressors and name in self.extra_regressors:
            raise ValueError(
                'Name "{}" already used for an added regressor.'.format(name))
github facebook / prophet / python / fbprophet / forecaster.py View on Github external
Built-in country holidays can only be set for a single country.

        Parameters
        ----------
        country_name: Name of the country, like 'UnitedStates' or 'US'

        Returns
        -------
        The prophet object.
        """
        if self.history is not None:
            raise Exception(
                "Country holidays must be added prior to model fitting."
            )
        # Validate names.
        for name in get_holiday_names(country_name):
            # Allow merging with existing holidays
            self.validate_column_name(name, check_holidays=False)
        # Set the holidays.
        if self.country_holidays is not None:
            logger.warning(
                'Changing country holidays from {} to {}'.format(
                    self.country_holidays, country_name
                )
            )
        self.country_holidays = country_name
        return self