dasi.cost.utils¶
Cost utilities.
Functions
|
Expand a pandas data frame, which has min and max span columns defined, into a numpy ndarray. |
|
Find duplicates within the specified axes. |
|
Flatten the array along the specified axes. |
|
|
|
Broadcast b to the a_axis of ndarray ‘a’ and perform a hstack. |
|
Classes
|
Functions
|
Expand a pandas data frame, which has min and max span columns defined, into a numpy ndarray. |
|
Find duplicates within the specified axes. |
|
Flatten the array along the specified axes. |
|
Broadcast b to the a_axis of ndarray ‘a’ and perform a hstack. |
-
dasi.cost.utils.
df_to_np_ranged
(min_col, max_col, df, cols=None, dtype=None)[source]¶ Expand a pandas data frame, which has min and max span columns defined, into a numpy ndarray. Specific columns to include in the expansion can be defined in the remaining_cols argument, else all columns are used.
For example:
df = pd.DataFrame([ [0, 10, 10], [10, 20, 100] ], columns=['min', 'max', 'x']) a = df_to_np_ranged('min', 'max', df, dtype=np.float64) assert a.shape == (20, 2) assert a[5] == [5., 10.] assert a[17] == [17., 100.]
-
dasi.cost.utils.
duplicates
(b, axis=None)[source]¶ Find duplicates within the specified axes.
If axis not provided, flatten array and return duplicates.