Skip to content
Snippets Groups Projects

target broadcasting and numpy array support for generics

Merged Peter Lünenschloß requested to merge genericfuncTypeIndulgence into develop
All threads resolved!
2 files
+ 3
2
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 3
1
@@ -83,15 +83,17 @@ def _inferBroadcast(obj, trg_shape) -> pd.DataFrame:
return np.full(trg_shape, obj)
return obj
def _inferDF(obj, cols, index):
# infer dataframe if result is numpy array of fitting shape
if isinstance(obj, np.ndarray):
lc = len(cols)
li = len(index)
if (obj.shape == (li,lc)) or (obj.shape == (li,)):
if (obj.shape == (li, lc)) or (obj.shape == (li,)):
return pd.DataFrame(obj, columns=cols, index=index)
return obj
def _castResult(obj) -> DictOfSeries:
# Note: the actual keys aka. column names
# we use here to create a DictOfSeries
Loading