Untitled
unknown
plain_text
2 years ago
2.8 kB
17
Indexable
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 4 entries, 0 to 3
Data columns (total 10 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 event 4 non-null object
1 246 4 non-null int64
2 247 4 non-null int64
3 248 4 non-null int64
4 AA 4 non-null int64
5 all 4 non-null int64
6 share_246 4 non-null float64
7 share_247 4 non-null float64
8 share_248 4 non-null float64
9 share_246_247 4 non-null float64
z_test('AA', 248, 0.05)
KeyError Traceback (most recent call last)
/opt/conda/lib/python3.9/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/index_class_helper.pxi in pandas._libs.index.Int64Engine._check_type()
KeyError: 'AA'
The above exception was the direct cause of the following exception:
KeyError Traceback (most recent call last)
/tmp/ipykernel_268/538264847.py in <module>
----> 1 z_test('AA', 248, 0.05)
/tmp/ipykernel_268/2214059070.py in z_test(test_group1, test_group2, alpha)
4 for i in group_test.index:
5 # пропорция успехов в первой группе
----> 6 p1 = group_test[test_group1][i] / gr_users[test_group1]
7 # пропорция успехов во второй группе:
8 p2 = group_test[test_group2][i] / gr_users[test_group2]
/opt/conda/lib/python3.9/site-packages/pandas/core/series.py in __getitem__(self, key)
851
852 elif key_is_scalar:
--> 853 return self._get_value(key)
854
855 if is_hashable(key):
/opt/conda/lib/python3.9/site-packages/pandas/core/series.py in _get_value(self, label, takeable)
959
960 # Similar to Index.get_value, but we do not fall back to positional
--> 961 loc = self.index.get_loc(label)
962 return self.index._get_values_for_loc(self, loc, label)
963
/opt/conda/lib/python3.9/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: 'AA'
Editor is loading...