I have an error: KeyError Traceback (most recent call last) ~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance) 3079 try: -> 3080 return self._engine.get_loc(casted_key) 3081 except KeyError as err:
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, 0)
The above exception was the direct cause of the following exception:
KeyError Traceback (most recent call last) in 3 penalty = num_assets # set parameter to scale the budget penalty term 4 ----> 5 qubitOp, offset = portfolio.get_operator(mu, sigma, q, budget, penalty) 6 print (qubitOp, offset)
~\anaconda3\lib\site-packages\qiskit\finance\applications\ising\portfolio.py in get_operator(mu, sigma, q, budget, penalty) 80 zp[j_] = True 81 pauli_list.append([2 * sigma_z[i_, j_], Pauli((zp, xp))]) ---> 82 offset += sigma_z[i_, i_] 83 84 return WeightedPauliOperator(paulis=pauli_list), offset
~\anaconda3\lib\site-packages\pandas\core\frame.py in getitem(self, key) 3022 if self.columns.nlevels > 1: 3023 return self._getitem_multilevel(key) -> 3024 indexer = self.columns.get_loc(key) 3025 if is_integer(indexer): 3026 indexer = [indexer]
~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance) 3080 return self._engine.get_loc(casted_key) 3081 except KeyError as err: -> 3082 raise KeyError(key) from err 3083 3084 if tolerance is not None:
KeyError: (0, 0)
KeyError Traceback (most recent call last) ~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance) 3079 try: -> 3080 return self._engine.get_loc(casted_key) 3081 except KeyError as err:
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, 0)
The above exception was the direct cause of the following exception:
KeyError Traceback (most recent call last) in 3 penalty = num_assets # set parameter to scale the budget penalty term 4 ----> 5 qubitOp, offset = portfolio.get_operator(mu, sigma, q, budget, penalty) 6 print (qubitOp, offset)
~\anaconda3\lib\site-packages\qiskit\finance\applications\ising\portfolio.py in get_operator(mu, sigma, q, budget, penalty) 80 zp[j_] = True 81 pauli_list.append([2 * sigma_z[i_, j_], Pauli((zp, xp))]) ---> 82 offset += sigma_z[i_, i_] 83 84 return WeightedPauliOperator(paulis=pauli_list), offset
~\anaconda3\lib\site-packages\pandas\core\frame.py in getitem(self, key) 3022 if self.columns.nlevels > 1: 3023 return self._getitem_multilevel(key) -> 3024 indexer = self.columns.get_loc(key) 3025 if is_integer(indexer): 3026 indexer = [indexer]
~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance) 3080 return self._engine.get_loc(casted_key) 3081 except KeyError as err: -> 3082 raise KeyError(key) from err 3083 3084 if tolerance is not None:
KeyError: (0, 0)