Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index error #35

Open
jhyun0919 opened this issue Jan 14, 2016 · 0 comments
Open

index error #35

jhyun0919 opened this issue Jan 14, 2016 · 0 comments

Comments

@jhyun0919
Copy link

In [13]: elec.proportion_of_energy_submetered()

Running MeterGroup.proportion_of_energy_submetered...
/root/nilmtk/nilmtk/metergroup.py:901: UserWarning: As a quick implementation we only get Good Sections from the first meter in the meter group. We should really return the intersection of the good sections for all meters. This will be fixed...
warn("As a quick implementation we only get Good Sections from"
/root/nilmtk/nilmtk/stats/goodsectionsresults.py:145: FutureWarning: convert_objects is deprecated. Use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric.
return df.convert_objects()
Calculating total_energy for ElecMeterID(instance=1, building=1, dataset='REDD') ... /root/nilmtk/nilmtk/stats/totalenergyresults.py:41: FutureWarning: convert_objects is deprecated. Use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric.
return self._data.fillna(0).convert_objects()
Calculating total_energy for ElecMeterID(instance=2, building=1, dataset='REDD') ... /root/nilmtk/nilmtk/electric.py:307: UserWarning: No shared AC types. Using 'active' for submeter and 'apparent' for other.
" and '{:s}' for other.".format(ac_type, other_ac_type))
/root/anaconda2/envs/nilmtk-env/lib/python2.7/site-packages/pandas/tseries/base.py:100: DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
val = getitem(key)

IndexError Traceback (most recent call last)
in ()
----> 1 elec.proportion_of_energy_submetered()

/root/nilmtk/nilmtk/metergroup.pyc in proportion_of_energy_submetered(self, *_loader_kwargs)
1050 if verbose:
1051 print("Calculating proportion for", m)
-> 1052 prop = m.proportion_of_energy(mains, *_loader_kwargs)
1053 if not np.isnan(prop):
1054 proportion += prop

/root/nilmtk/nilmtk/electric.pyc in proportion_of_energy(self, other, **loader_kwargs)
282 float [0,1] or NaN if other.total_energy == 0
283 """
--> 284 good_other_sections = other.good_sections(**loader_kwargs)
285 loader_kwargs.setdefault('sections', good_other_sections)
286

/root/nilmtk/nilmtk/metergroup.pyc in good_sections(self, **kwargs)
903 " return the intersection of the good sections for all"
904 " meters. This will be fixed...")
--> 905 return self.meters[0].good_sections(**kwargs)
906 else:
907 return []

/root/nilmtk/nilmtk/elecmeter.pyc in good_sections(self, **loader_kwargs)
630 results_obj = GoodSections.results_class(self.device['max_sample_period'])
631 return self._get_stat_from_cache_or_compute(
--> 632 nodes, results_obj, loader_kwargs)
633
634 def _get_stat_from_cache_or_compute(self, nodes, results_obj, loader_kwargs):

/root/nilmtk/nilmtk/elecmeter.pyc in _get_stat_from_cache_or_compute(self, nodes, results_obj, loader_kwargs)
684 if loader_kwargs.get('preprocessing') is None:
685 cached_stat = self.get_cached_stat(key_for_cached_stat)
--> 686 results_obj.import_from_cache(cached_stat, sections)
687
688 def find_sections_to_compute():

/root/nilmtk/nilmtk/stats/goodsectionsresults.pyc in import_from_cache(self, cached_stat, sections)
116 timeframes = []
117 for _, row in sections_df.iterrows():
--> 118 section_start = tz_localize_naive(row['section_start'], tz)
119 section_end = tz_localize_naive(row['section_end'], tz)
120 timeframes.append(TimeFrame(section_start, section_end))

/root/anaconda2/envs/nilmtk-env/lib/python2.7/site-packages/pandas/core/series.pyc in getitem(self, key)
555 def getitem(self, key):
556 try:
--> 557 result = self.index.get_value(self, key)
558
559 if not np.isscalar(result):

/root/anaconda2/envs/nilmtk-env/lib/python2.7/site-packages/pandas/core/index.pyc in get_value(self, series, key)
1778 s = getattr(series,'_values',None)
1779 if isinstance(s, Index) and lib.isscalar(key):
-> 1780 return s[key]
1781
1782 s = _values_from_object(series)

/root/anaconda2/envs/nilmtk-env/lib/python2.7/site-packages/pandas/tseries/base.pyc in getitem(self, key)
98 getitem = self._data.getitem
99 if np.isscalar(key):
--> 100 val = getitem(key)
101 return self._box_func(val)
102 else:

IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

In [36]: fridge_meter.dropout_rate()

IndexError Traceback (most recent call last)
in ()
----> 1 fridge_meter.dropout_rate()

/root/nilmtk/nilmtk/elecmeter.pyc in dropout_rate(self, ignore_gaps, **loader_kwargs)
609 nodes = [DropoutRate]
610 if ignore_gaps:
--> 611 loader_kwargs['sections'] = self.good_sections(**loader_kwargs)
612
613 return self._get_stat_from_cache_or_compute(

/root/nilmtk/nilmtk/elecmeter.pyc in good_sections(self, **loader_kwargs)
630 results_obj = GoodSections.results_class(self.device['max_sample_period'])
631 return self._get_stat_from_cache_or_compute(
--> 632 nodes, results_obj, loader_kwargs)
633
634 def _get_stat_from_cache_or_compute(self, nodes, results_obj, loader_kwargs):

/root/nilmtk/nilmtk/elecmeter.pyc in _get_stat_from_cache_or_compute(self, nodes, results_obj, loader_kwargs)
684 if loader_kwargs.get('preprocessing') is None:
685 cached_stat = self.get_cached_stat(key_for_cached_stat)
--> 686 results_obj.import_from_cache(cached_stat, sections)
687
688 def find_sections_to_compute():

/root/nilmtk/nilmtk/stats/goodsectionsresults.pyc in import_from_cache(self, cached_stat, sections)
116 timeframes = []
117 for _, row in sections_df.iterrows():
--> 118 section_start = tz_localize_naive(row['section_start'], tz)
119 section_end = tz_localize_naive(row['section_end'], tz)
120 timeframes.append(TimeFrame(section_start, section_end))

/root/anaconda2/envs/nilmtk-env/lib/python2.7/site-packages/pandas/core/series.pyc in getitem(self, key)
555 def getitem(self, key):
556 try:
--> 557 result = self.index.get_value(self, key)
558
559 if not np.isscalar(result):

/root/anaconda2/envs/nilmtk-env/lib/python2.7/site-packages/pandas/core/index.pyc in get_value(self, series, key)
1778 s = getattr(series,'_values',None)
1779 if isinstance(s, Index) and lib.isscalar(key):
-> 1780 return s[key]
1781
1782 s = _values_from_object(series)

/root/anaconda2/envs/nilmtk-env/lib/python2.7/site-packages/pandas/tseries/base.pyc in getitem(self, key)
98 getitem = self._data.getitem
99 if np.isscalar(key):
--> 100 val = getitem(key)
101 return self._box_func(val)
102 else:

IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant