pastas / pastastore

:spaghetti: :convenience_store: Tools for managing timeseries and Pastas models

Home Page:https://pastastore.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeyError on step trend

marcovanbaar opened this issue · comments

KeyError: 'step0_A'

In function:
pst.util.frontiers_checks(pstore, modelnames)

Same issue with linear-trend.

Please skip the check on step/linear trend (and possible others) with a warning or implement a check,

Kind regards,
Marco

Some error-code:

a= pst.util.frontiers_checks(pstore,
modelnames=["".join(code)+name],
check1_rsq = True,
check1_threshold = 0.7,
check2_autocor = True,
check3_tmem = True,
check4_gain = True)
Running model diagnostics: 0%| | 0/1 [00:00<?, ?it/s]C:\Users\mvanb\anaconda3\envs\Evides_TRA_Bwal\lib\site-packages\pastastore\util.py:766: FutureWarning: In a future version, object-dtype columns with all-bool values will not be included in reductions with bool_only=True. Explicitly cast to bool dtype instead.
C:\Users\mvanb\anaconda3\envs\Evides_TRA_Bwal\lib\site-packages\pastastore\util.py:747: FutureWarning: In a future version, object-dtype columns with all-bool values will not be included in reductions with bool_only=True. Explicitly cast to bool dtype instead.
C:\Users\mvanb\anaconda3\envs\Evides_TRA_Bwal\lib\site-packages\pastastore\util.py:747: FutureWarning: In a future version, object-dtype columns with all-bool values will not be included in reductions with bool_only=True. Explicitly cast to bool dtype instead.
C:\Users\mvanb\anaconda3\envs\Evides_TRA_Bwal\lib\site-packages\pastastore\util.py:747: FutureWarning: In a future version, object-dtype columns with all-bool values will not be included in reductions with bool_only=True. Explicitly cast to bool dtype instead.
C:\Users\mvanb\anaconda3\envs\Evides_TRA_Bwal\lib\site-packages\pastastore\util.py:747: FutureWarning: In a future version, object-dtype columns with all-bool values will not be included in reductions with bool_only=True. Explicitly cast to bool dtype instead.

Traceback (most recent call last):

File ~\anaconda3\envs\Evides_TRA_Bwal\lib\site-packages\pandas\core\indexes\base.py:3802 in get_loc
return self._engine.get_loc(casted_key)

File pandas_libs\index.pyx:138 in pandas._libs.index.IndexEngine.get_loc

File pandas_libs\index.pyx:165 in pandas._libs.index.IndexEngine.get_loc

File pandas_libs\hashtable_class_helper.pxi:5745 in pandas._libs.hashtable.PyObjectHashTable.get_item

File pandas_libs\hashtable_class_helper.pxi:5753 in pandas._libs.hashtable.PyObjectHashTable.get_item

KeyError: 'step0_A'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

Cell In[516], line 1
a= pst.util.frontiers_checks(pstore,

File ~\anaconda3\envs\Evides_TRA_Bwal\lib\site-packages\pastastore\util.py:756 in frontiers_checks
gain = ml.parameters.loc[f"{sm_name}_A", "optimal"]

File ~\anaconda3\envs\Evides_TRA_Bwal\lib\site-packages\pandas\core\indexing.py:1066 in getitem
return self.obj._get_value(*key, takeable=self._takeable)

File ~\anaconda3\envs\Evides_TRA_Bwal\lib\site-packages\pandas\core\frame.py:3924 in _get_value
row = self.index.get_loc(index)

File ~\anaconda3\envs\Evides_TRA_Bwal\lib\site-packages\pandas\core\indexes\base.py:3804 in get_loc
raise KeyError(key) from err

KeyError: 'step0_A'

should be fixed now by 5e807a2

instead of the gain (_A), I now check _d for steptrend and _a for lineartrend