MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / guarantee_multiindex_rows

Function guarantee_multiindex_rows

deeplabcut/utils/conversioncode.py:357–372  ·  view source on GitHub ↗
(df)

Source from the content-addressed store, hash-verified

355
356
357def guarantee_multiindex_rows(df):
358 # Make paths platform-agnostic if they are not already
359 if not isinstance(df.index, pd.MultiIndex): # Backwards compatibility
360 path = df.index[0]
361 try:
362 sep = "/" if "/" in path else "\\"
363 splits = tuple(df.index.str.split(sep))
364 df.index = pd.MultiIndex.from_tuples(splits)
365 except TypeError: # Ignore numerical index of frame indices
366 pass
367
368 # Ensure folder names are strings
369 try:
370 df.index = df.index.set_levels(df.index.levels[1].astype(str), level=1)
371 except AttributeError:
372 pass
373
374
375def robust_split_path(s):

Calls 1

splitMethod · 0.45