У меня есть мультииндексный фрейм данных y_test
:
blockNumber_base10@coarsegrained#1024 address_idx
9441280 2 -0.012421
3 0.001400
6 -0.012696
7 0.003558
15 0.003649
...
9854976 935783 0.000000
935785 0.000000
935786 0.000000
935788 0.000000
935789 0.000000
Name: price@fwd#001024@div#price#m1, Length: 1146272, dtype: float64
Мы хотим сравнить с groupby min.
y_test_tmp = y_test.groupby(level = 0).quantile(0.8)
blockNumber_base10@coarsegrained#1024
9441280 0.005130
9442304 0.000973
9443328 0.000461
9444352 0.001354
9445376 0.000921
...
9850880 0.000552
9851904 0.000953
9852928 0.000591
9853952 0.000000
9854976 0.000000
Name: price@fwd#001024@div#price#m1, Length: 405, dtype: float64
Я хочу сравнить с ними на основе blockNumber_base10@coarsegrained#1024
, поэтому я хотел вычислить y_test > y_test_tmp
. Но я получил эту ошибку:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-318-ad2813982941> in <module>
----> 1 y_test > y_test_tmp
~/anaconda3/lib/python3.8/site-packages/pandas/core/ops/common.py in new_method(self, other)
63 other = item_from_zerodim(other)
64
---> 65 return method(self, other)
66
67 return new_method
~/anaconda3/lib/python3.8/site-packages/pandas/core/arraylike.py in __gt__(self, other)
43 @unpack_zerodim_and_defer("__gt__")
44 def __gt__(self, other):
---> 45 return self._cmp_method(other, operator.gt)
46
47 @unpack_zerodim_and_defer("__ge__")
~/anaconda3/lib/python3.8/site-packages/pandas/core/series.py in _cmp_method(self, other, op)
4971
4972 if isinstance(other, Series) and not self._indexed_same(other):
-> 4973 raise ValueError("Can only compare identically-labeled Series objects")
4974
4975 lvalues = extract_array(self, extract_numpy=True)
ValueError: Can only compare identically-labeled Series objects
Есть предложения? Спасибо!
любезно предоставьте простой воспроизводимый пример с ожидаемым результатом