Dear community,
I have an energy system that can be optimized (not infeasible).
When i call:
model.resutls()
I get the error:
Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\pandas\core\algorithms.py", line 2066, in safe_sort
sorter = values.argsort()
TypeError: '<' not supported between instances of 'int' and 'str'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\pandas\core\arrays\categorical.py", line 343, in __init__
codes, categories = factorize(values, sort=True)
File "C:\Anaconda\lib\site-packages\pandas\core\algorithms.py", line 682, in factorize
uniques, codes = safe_sort(
File "C:\Anaconda\lib\site-packages\pandas\core\algorithms.py", line 2070, in safe_sort
ordered = sort_mixed(values)
File "C:\Anaconda\lib\site-packages\pandas\core\algorithms.py", line 2053, in sort_mixed
nums = np.sort(values[~str_pos])
File "<__array_function__ internals>", line 5, in sort
File "C:\Anaconda\lib\site-packages\numpy\core\fromnumeric.py", line 991, in sort
a.sort(axis=axis, kind=kind, order=order)
TypeError: '<' not supported between instances of 'int' and 'str'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<ipython-input-19-d7475e37b200>", line 1, in <module>
saka.results()
File "C:\Anaconda\lib\site-packages\oemof\solph\models.py", line 179, in results
return processing.results(self)
File "C:\Anaconda\lib\site-packages\oemof\solph\processing.py", line 125, in results
df = create_dataframe(om)
File "C:\Anaconda\lib\site-packages\oemof\solph\processing.py", line 107, in create_dataframe
df = df.sort_values(["oemof_tuple", "timestep"], ascending=[True, True])
File "C:\Anaconda\lib\site-packages\pandas\core\frame.py", line 5286, in sort_values
indexer = lexsort_indexer(
File "C:\Anaconda\lib\site-packages\pandas\core\sorting.py", line 229, in lexsort_indexer
cat = Categorical(k, ordered=True)
File "C:\Anaconda\lib\site-packages\pandas\core\arrays\categorical.py", line 349, in __init__
raise TypeError(
TypeError: 'values' is not ordered, please explicitly specify the categories order by passing in a categories argument.
Strange is that i do net get this error everytime. So it can happen that when I run the same model twice, one time I get the error and the other time not.
Has anyone experienced a similar problem?
Best,
Matthias