relib 1.0.3__py3-none-any.whl → 1.0.4__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 +1 -0
- relib/utils.py +7 -1
- {relib-1.0.3.dist-info → relib-1.0.4.dist-info}/METADATA +1 -1
- relib-1.0.4.dist-info/RECORD +10 -0
- relib-1.0.3.dist-info/RECORD +0 -10
- {relib-1.0.3.dist-info → relib-1.0.4.dist-info}/LICENSE.txt +0 -0
- {relib-1.0.3.dist-info → relib-1.0.4.dist-info}/WHEEL +0 -0
- {relib-1.0.3.dist-info → relib-1.0.4.dist-info}/top_level.txt +0 -0
relib/__init__.py
CHANGED
relib/utils.py
CHANGED
@@ -73,6 +73,9 @@ def omit(d: dict[K, T], keys: Iterable[K]) -> dict[K, T]:
|
|
73
73
|
del d[key]
|
74
74
|
return d
|
75
75
|
|
76
|
+
def pick(d: dict[K, T], keys: Iterable[K]) -> dict[K, T]:
|
77
|
+
return {key: d[key] for key in keys}
|
78
|
+
|
76
79
|
def dict_by(keys: Iterable[K], values: Iterable[T]) -> dict[K, T]:
|
77
80
|
return dict(zip(keys, values))
|
78
81
|
|
@@ -132,6 +135,9 @@ def num_partitions(values: Iterable[T], num_parts: int) -> list[list[T]]:
|
|
132
135
|
part_size = (len(values) / num_parts).__ceil__()
|
133
136
|
return [values[i * part_size:(i + 1) * part_size] for i in range(num_parts)]
|
134
137
|
|
138
|
+
def _cat_tile(cats, n_tile):
|
139
|
+
return cats[np.tile(np.arange(len(cats)), n_tile)]
|
140
|
+
|
135
141
|
def df_from_array(
|
136
142
|
value_cols: dict[str, np.ndarray],
|
137
143
|
dim_labels: list[tuple[str, list[Union[str, int, float]]]],
|
@@ -145,7 +151,7 @@ def df_from_array(
|
|
145
151
|
for i in range(len(dim_sizes))
|
146
152
|
]
|
147
153
|
label_arrays = [
|
148
|
-
|
154
|
+
_cat_tile(pd.Categorical(labels).repeat(repeats), tiles)
|
149
155
|
for labels, (repeats, tiles) in zip(dim_labels, repeats_tiles)
|
150
156
|
]
|
151
157
|
df = pd.DataFrame(dict(zip(dim_names, label_arrays)))
|
@@ -0,0 +1,10 @@
|
|
1
|
+
relib/__init__.py,sha256=d7vbtHV079on1ZRQeT5SAxNHtfSd14JDN1fHCGbbsjE,446
|
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=V5pdaO2qZWjOkr__eMbFfF2X4mdk9b2THQ8Ve26UJcU,5221
|
6
|
+
relib-1.0.4.dist-info/LICENSE.txt,sha256=t9LfkVbmcvZjP0x3Sq-jR38UfTNbNtRQvc0Q8HWmLak,1054
|
7
|
+
relib-1.0.4.dist-info/METADATA,sha256=lzPhG9j-DBJ_X6-camK9N7pAoTp8dLJ6V-e3GQWsPpI,260
|
8
|
+
relib-1.0.4.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
9
|
+
relib-1.0.4.dist-info/top_level.txt,sha256=Yc96FwkbRYj4AQVatga8uK4hH9ATKI9XIyEH_1ba6KQ,6
|
10
|
+
relib-1.0.4.dist-info/RECORD,,
|
relib-1.0.3.dist-info/RECORD
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
relib/__init__.py,sha256=pUJoJ4ctBeistvdRn_jrQUDAVXsBVwBf_0LdcbCkkuc,438
|
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=pd4iigtwQah2kAQnwhBJ4VfGlsiXfY-geP1Ormws-aQ,5040
|
6
|
-
relib-1.0.3.dist-info/LICENSE.txt,sha256=t9LfkVbmcvZjP0x3Sq-jR38UfTNbNtRQvc0Q8HWmLak,1054
|
7
|
-
relib-1.0.3.dist-info/METADATA,sha256=8SDVU5Tu5LoEtThzqtrE78PX_D9UCZ8gxr6AXi2RWNA,260
|
8
|
-
relib-1.0.3.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
9
|
-
relib-1.0.3.dist-info/top_level.txt,sha256=Yc96FwkbRYj4AQVatga8uK4hH9ATKI9XIyEH_1ba6KQ,6
|
10
|
-
relib-1.0.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|