MCPcopy Create free account
hub / github.com/dask/dask / idxmaxmin_row

Function idxmaxmin_row

dask/dataframe/core.py:329–344  ·  view source on GitHub ↗
(x, fn=None, skipna=True)

Source from the content-addressed store, hash-verified

327
328
329def idxmaxmin_row(x, fn=None, skipna=True):
330 minmax = "max" if fn == "idxmax" else "min"
331 if len(x) > 0:
332 x = x.set_index("idx")
333 # potentially coerced to object, so cast back
334 value = x.value.infer_objects()
335 idx = [getattr(value, fn)(skipna=skipna)]
336 value = [getattr(value, minmax)(skipna=skipna)]
337 else:
338 idx = value = meta_series_constructor(x)([], dtype="i8")
339 return meta_frame_constructor(x)(
340 {
341 "idx": meta_series_constructor(x)(idx, dtype=x.index.dtype),
342 "value": meta_series_constructor(x)(value, dtype=x.dtypes.iloc[0]),
343 }
344 )
345
346
347def idxmaxmin_combine(x, fn=None, skipna=True):

Callers

nothing calls this directly

Calls 3

meta_series_constructorFunction · 0.90
meta_frame_constructorFunction · 0.90
set_indexMethod · 0.80

Tested by

no test coverage detected