relib 1.0.5__py3-none-any.whl → 1.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- relib/__init__.py +2 -1
- relib/utils.py +11 -7
- {relib-1.0.5.dist-info → relib-1.0.6.dist-info}/METADATA +1 -1
- relib-1.0.6.dist-info/RECORD +10 -0
- {relib-1.0.5.dist-info → relib-1.0.6.dist-info}/WHEEL +1 -1
- relib-1.0.5.dist-info/RECORD +0 -10
- {relib-1.0.5.dist-info → relib-1.0.6.dist-info}/LICENSE.txt +0 -0
- {relib-1.0.5.dist-info → relib-1.0.6.dist-info}/top_level.txt +0 -0
relib/__init__.py
CHANGED
relib/utils.py
CHANGED
@@ -22,9 +22,14 @@ def drop_none(l: Iterable[Union[T, None]]) -> list[T]:
|
|
22
22
|
def distinct(items: Iterable[T]) -> list[T]:
|
23
23
|
return list(set(items))
|
24
24
|
|
25
|
-
def
|
25
|
+
def first(iterable: Iterable[T]) -> Union[T, None]:
|
26
26
|
return next(iter(iterable), None)
|
27
27
|
|
28
|
+
def move_value(l: Iterable[T], from_i: int, to_i: int) -> list[T]:
|
29
|
+
l = list(l)
|
30
|
+
l.insert(to_i, l.pop(from_i))
|
31
|
+
return l
|
32
|
+
|
28
33
|
def transpose_dict(des):
|
29
34
|
if isinstance(des, list):
|
30
35
|
keys = list(des[0].keys()) if des else []
|
@@ -148,15 +153,14 @@ def df_from_array(
|
|
148
153
|
dim_names = [name for name, _ in dim_labels]
|
149
154
|
dim_sizes = np.array([len(labels) for _, labels in dim_labels])
|
150
155
|
assert all(array.shape == tuple(dim_sizes) for array in value_cols.values())
|
151
|
-
|
156
|
+
array_offsets = [
|
152
157
|
(dim_sizes[i + 1:].prod(), dim_sizes[:i].prod())
|
153
158
|
for i in range(len(dim_sizes))
|
154
159
|
]
|
155
|
-
|
156
|
-
_cat_tile(pd.Categorical(labels).repeat(repeats), tiles)
|
157
|
-
for labels, (repeats, tiles) in zip(dim_labels,
|
158
|
-
|
159
|
-
category_cols = dict(zip(dim_names, label_arrays))
|
160
|
+
category_cols = {
|
161
|
+
dim: _cat_tile(pd.Categorical(labels).repeat(repeats), tiles)
|
162
|
+
for dim, labels, (repeats, tiles) in zip(dim_names, dim_labels, array_offsets)
|
163
|
+
}
|
160
164
|
value_cols = {name: array.reshape(-1) for name, array in value_cols.items()}
|
161
165
|
df = pd.DataFrame({**category_cols, **value_cols}, copy=False)
|
162
166
|
if indexed:
|
@@ -0,0 +1,10 @@
|
|
1
|
+
relib/__init__.py,sha256=4yr8xPi3VMbiFlApussB4OXU_U6wzhje06qD0Ad3Gq4,471
|
2
|
+
relib/hashing.py,sha256=6iAPRiJI_4jaSooZRFJnqK2limXqTmErzcwpd050LAA,8943
|
3
|
+
relib/measure_duration.py,sha256=jJa5Kh5FxaBysS__nkwqcnTt8Uc2niLucXfTzFE0j-E,555
|
4
|
+
relib/raypipe.py,sha256=ynEoXs1dnD-360_uQC8v89xjiilt3knpocXpFaQ3plA,1905
|
5
|
+
relib/utils.py,sha256=JM68czDzWLOa2ADbBEdAb7j4Zv3RFYMws5sy0ghxbW0,5353
|
6
|
+
relib-1.0.6.dist-info/LICENSE.txt,sha256=t9LfkVbmcvZjP0x3Sq-jR38UfTNbNtRQvc0Q8HWmLak,1054
|
7
|
+
relib-1.0.6.dist-info/METADATA,sha256=NVAMcPbnJrlRd_W8QRuX93F-gHSg47L9dGBf5ap7tnw,260
|
8
|
+
relib-1.0.6.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
9
|
+
relib-1.0.6.dist-info/top_level.txt,sha256=Yc96FwkbRYj4AQVatga8uK4hH9ATKI9XIyEH_1ba6KQ,6
|
10
|
+
relib-1.0.6.dist-info/RECORD,,
|
relib-1.0.5.dist-info/RECORD
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
relib/__init__.py,sha256=Zm6aMrr9A70laX2otqq60JLSO9bLiiwIQQJmk2Qzp_k,456
|
2
|
-
relib/hashing.py,sha256=6iAPRiJI_4jaSooZRFJnqK2limXqTmErzcwpd050LAA,8943
|
3
|
-
relib/measure_duration.py,sha256=jJa5Kh5FxaBysS__nkwqcnTt8Uc2niLucXfTzFE0j-E,555
|
4
|
-
relib/raypipe.py,sha256=ynEoXs1dnD-360_uQC8v89xjiilt3knpocXpFaQ3plA,1905
|
5
|
-
relib/utils.py,sha256=Gh_Mb1z8FyzsPAsdCiNLUskztr16ajSrvzQ_lvAn_Tk,5258
|
6
|
-
relib-1.0.5.dist-info/LICENSE.txt,sha256=t9LfkVbmcvZjP0x3Sq-jR38UfTNbNtRQvc0Q8HWmLak,1054
|
7
|
-
relib-1.0.5.dist-info/METADATA,sha256=a8d2h8VbXerVegSy2fq3gpWhyHubrfs5UVQKz7Ybqls,260
|
8
|
-
relib-1.0.5.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
9
|
-
relib-1.0.5.dist-info/top_level.txt,sha256=Yc96FwkbRYj4AQVatga8uK4hH9ATKI9XIyEH_1ba6KQ,6
|
10
|
-
relib-1.0.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|