aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/analytics/basket_index.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/python/analytics/basket_index.py b/python/analytics/basket_index.py
index 83d03421..eed96657 100644
--- a/python/analytics/basket_index.py
+++ b/python/analytics/basket_index.py
@@ -2,7 +2,6 @@ from .index_data import get_index_quotes, get_singlenames_curves
from .db import _engine
from .utils import tenor_t
from functools import partial
-from pandas.util import hash_pandas_object
from pyisda.credit_index import CreditIndex
from pyisda.date import previous_twentieth
from typing import List
@@ -76,21 +75,15 @@ class BasketIndex(CreditIndex):
def __hash__(self):
def aux(v):
- if isinstance(v, pd.DataFrame):
- return hash_pandas_object(v).sum()
- elif isinstance(v, list):
+ if isinstance(v, list):
return hash(tuple(v))
elif type(v) is np.ndarray:
return hash(v.tobytes())
else:
return hash(v)
- ignore = set(['_Z', '_w', '_skew'])
- for k, v in vars(self).items():
- if k not in ignore:
- print(k, aux(v))
- return hash((CreditIndex.__hash__(self),
- hash(frozenset([(k, aux(v)) for k, v in vars(self).items() \
- if k not in ignore]))))
+ ignore = set(['_Z', '_w', '_skew', 'tenors', 'index_desc'])
+ return hash((CreditIndex.__hash__(self),) + tuple(aux(v) for k, v in vars(self).items()
+ if k not in ignore))
def _query_version(self, i):
for lastdate, *data in self._version: