Description
I am trying to run the bcsd example and the following code
out = bcsd_temp.predict(X_temp) + X_temp
gives the error as below
AttributeErrorTraceback (most recent call last)
in
2 bcsd_temp = BcsdTemperature()
3 bcsd_temp.fit(X_temp, y_temp)
----> 4 out = bcsd_temp.predict(X_temp) + X_temp
5 plot_cdf(X=X_temp, y=y_temp, out=out)
6 out.plot()
~/manmeet/dev_lab/scikit-downscale-0.0.2/examples/skdownscale/pointwise_models/bcsd.py in predict(self, X)
184 # why isn't this working??
185 # X_shift = X_rolling_mean.groupby(self.time_grouper) - self._x_climo
--> 186 X_shift = self._remove_climatology(X_rolling_mean, self._x_climo)
187
188 # remove shift
~/manmeet/dev_lab/scikit-downscale-0.0.2/examples/skdownscale/pointwise_models/bcsd.py in _remove_climatology(self, obj, climatology)
203 def _remove_climatology(self, obj, climatology):
204 dfs = []
--> 205 for key, group in obj.groupby(self.time_grouper):
206 dfs.append(group - climatology.loc[key].values)
207
~/manmeet/anaconda3/envs/causal/lib/python3.6/site-packages/pandas/core/frame.py in groupby(self, by, axis, level, as_index, sort, group_keys, squeeze, observed, dropna)
6523 squeeze=squeeze,
6524 observed=observed,
-> 6525 dropna=dropna,
6526 )
6527
~/manmeet/anaconda3/envs/causal/lib/python3.6/site-packages/pandas/core/groupby/groupby.py in init(self, obj, keys, axis, level, grouper, exclusions, selection, as_index, sort, group_keys, squeeze, observed, mutated, dropna)
531 observed=observed,
532 mutated=self.mutated,
--> 533 dropna=self.dropna,
534 )
535
~/manmeet/anaconda3/envs/causal/lib/python3.6/site-packages/pandas/core/groupby/grouper.py in get_grouper(obj, key, axis, level, sort, observed, mutated, validate, dropna)
812 dropna=dropna,
813 )
--> 814 if not isinstance(gpr, Grouping)
815 else gpr
816 )
~/manmeet/anaconda3/envs/causal/lib/python3.6/site-packages/pandas/core/groupby/grouper.py in init(self, index, grouper, obj, name, level, sort, observed, in_axis, dropna)
516 t = self.name or str(type(self.grouper))
517 raise ValueError(f"Grouper for '{t}' not 1-dimensional")
--> 518 self.grouper = self.index.map(self.grouper)
519 if not (
520 hasattr(self.grouper, "len")
~/manmeet/anaconda3/envs/causal/lib/python3.6/site-packages/pandas/core/indexes/base.py in map(self, mapper, na_action)
4795 from pandas.core.indexes.multi import MultiIndex
4796
-> 4797 new_values = super()._map_values(mapper, na_action=na_action)
4798
4799 attributes = self._get_attributes_dict()
~/manmeet/anaconda3/envs/causal/lib/python3.6/site-packages/pandas/core/base.py in _map_values(self, mapper, na_action)
1158
1159 # mapper is a function
-> 1160 new_values = map_f(values, mapper)
1161
1162 return new_values
pandas/_libs/lib.pyx in pandas._libs.lib.map_infer()
~/manmeet/dev_lab/scikit-downscale-0.0.2/examples/skdownscale/pointwise_models/bcsd.py in MONTH_GROUPER(x)
12
13 def MONTH_GROUPER(x):
---> 14 return x.month
15
16
AttributeError: 'tuple' object has no attribute 'month'