PYFTS / pyFTS

An open source library for Fuzzy Time Series in Python
http://pyfts.github.io/pyFTS/
GNU General Public License v3.0
259 stars 53 forks source link

error on analytic_tabular_dataframe() #10

Closed jermaine1ronquillo closed 5 years ago

jermaine1ronquillo commented 5 years ago

KeyError: '0'

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)

in () ----> 1 dat = bUtil.analytic_tabular_dataframe(df1) ~/miniconda3/envs/time_series/lib/python3.6/site-packages/pyFTS/benchmarks/Util.py in analytic_tabular_dataframe(dataframe) 180 if not df.empty: 181 for col in data_columns: --> 182 mod = [m, o, s, p, st, ms, df[col].values[0]] 183 ret.append(mod)
petroniocandido commented 5 years ago

Can you provide the code and data for error reproduction?

jermaine1ronquillo commented 5 years ago

I only used TAIEX data This is the code

from pyFTS.benchmarks import Util as bUtil

df1 = bUtil.get_dataframe_from_bd("benchmarks.db", "tag = 'chen_partitioning' and measure = 'rmse'and transformation is null") dat=bUtil.analytic_tabular_dataframe(df1)

the error


KeyError Traceback (most recent call last) ~/miniconda3/envs/time_series/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance) 2524 try: -> 2525 return self._engine.get_loc(key) 2526 except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: '0'

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)

in () ----> 1 dat=bUtil.analytic_tabular_dataframe(df1) ~/miniconda3/envs/time_series/lib/python3.6/site-packages/pyFTS/benchmarks/Util.py in analytic_tabular_dataframe(dataframe) 180 if not df.empty: 181 for col in data_columns: --> 182 mod = [m, o, s, p, st, ms, df[col].values[0]] 183 ret.append(mod) 184 ~/miniconda3/envs/time_series/lib/python3.6/site-packages/pandas/core/frame.py in __getitem__(self, key) 2137 return self._getitem_multilevel(key) 2138 else: -> 2139 return self._getitem_column(key) 2140 2141 def _getitem_column(self, key): ~/miniconda3/envs/time_series/lib/python3.6/site-packages/pandas/core/frame.py in _getitem_column(self, key) 2144 # get column 2145 if self.columns.is_unique: -> 2146 return self._get_item_cache(key) 2147 2148 # duplicate columns & possible reduce dimensionality ~/miniconda3/envs/time_series/lib/python3.6/site-packages/pandas/core/generic.py in _get_item_cache(self, item) 1840 res = cache.get(item) 1841 if res is None: -> 1842 values = self._data.get(item) 1843 res = self._box_item_values(item, values) 1844 cache[item] = res ~/miniconda3/envs/time_series/lib/python3.6/site-packages/pandas/core/internals.py in get(self, item, fastpath) 3841 3842 if not isna(item): -> 3843 loc = self.items.get_loc(item) 3844 else: 3845 indexer = np.arange(len(self.items))[isna(self.items)] ~/miniconda3/envs/time_series/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance) 2525 return self._engine.get_loc(key) 2526 except KeyError: -> 2527 return self._engine.get_loc(self._maybe_cast_indexer(key)) 2528 2529 indexer = self.get_indexer([key], method=method, tolerance=tolerance) pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc() pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc() pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item() pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item() KeyError: '0'