Пример #1
0
 def __init__(self, tag, timestamp, value, uom=None, *args, **kwargs):
     Series.__init__(self,
                     data=value,
                     index=timestamp,
                     name=tag,
                     *args, **kwargs)
     self.tag = tag
     self.uom = uom
    def __init__(self, data, name=None, dtype=None, index=None, copy=False,
                 fastpath=False, categorical=False):
        """
        A Series with extra information, e.g. categorical.

        Parameters
        ----------
        categorical : bool
            set categorical label for attribute. If categorical, this attribute
            takes on a limited and fixed number of possible values. Examples:
            blood type, gender.
        """
        Series.__init__(self, data, name=name, dtype=dtype, index=index,
                        copy=copy, fastpath=fastpath)

        # bins can be int (size of histogram bins), str (as algorithm name),
        self._bins = ds4ml.params['attribute.bins']

        self._min = None
        self._max = None
        self._step = None

        # probability distribution (pr)
        self.bins = None
        self.prs = None

        from pandas.api.types import infer_dtype
        # atype: date type for handle different kinds of attributes in data
        # synthesis, support: integer, float, string, datetime.
        self.atype = infer_dtype(self, skipna=True)
        if self.atype == 'integer':
            pass
        elif self.atype == 'floating' or self.atype == 'mixed-integer-float':
            self.atype = 'float'
        elif self.atype in ['string', 'mixed-integer', 'mixed']:
            self.atype = 'string'
            if all(map(utils.is_datetime, self._values)):
                self.atype = 'datetime'

        # fill the missing values with the most frequent value
        self.fillna(self.mode()[0], inplace=True)

        # special handling for datetime attribute
        if self.atype == 'datetime':
            self.update(self.map(self._to_seconds).map(self._date_formatter))

        if self.atype == 'float':
            self._decimals = self.decimals()

        # how to define the attribute is categorical.
        self.categorical = categorical or (
                self.atype == 'string' and not self.is_unique)
        self._set_domain()
        self._set_distribution()
Пример #3
0
    def __init__(self, data, dtime, **kwargs):
        """
	Time series w/ specific IO methods
	"""
        self.__dict__.update(kwargs)

        TimeSeries.__init__(self, data, index=dtime)
        #super(ObsTimeSeries,self).__init__(data,index=dtime)

        # Time coordinates
        self.nt = self.index.shape
        self.tsec = othertime.SecondsSince(self.index,\
         basetime = pd.datetime(self.baseyear,1,1))
Пример #4
0
 def __init__(self, input_brain=None, **kwargs):
     Series.__init__(self, input_brain, **kwargs)
     HasTraits.__init__(self)
     self._number_of_neurons = self.get_number_of_neurons()
Пример #5
0
 def __init__(self, label="", input_nodes=None, **kwargs):
     Series.__init__(self, input_nodes, name=str(label), **kwargs)
     HasTraits.__init__(self)
     self._number_of_neurons = self.get_number_of_neurons()
Пример #6
0
 def __init__(self, s, col_name=None, stat=None):
     Series.__init__(self, s)
     self.s = s
     self.stat = stat
     self.col_name = col_name
Пример #7
0
 def __init__(self, *args, **kwargs):
     Series.__init__(self, *args, **kwargs)