MCPcopy
hub / github.com/pandas-dev/pandas / is_potential_multi_index

Function is_potential_multi_index

pandas/io/common.py:1267–1295  ·  view source on GitHub ↗

Check whether or not the `columns` parameter could be converted into a MultiIndex. Parameters ---------- columns : array-like Object which may or may not be convertible into a MultiIndex index_col : None, bool or list, optional Column or columns to use as th

(
    columns: Sequence[Hashable] | MultiIndex,
    index_col: bool | Sequence[int] | None = None,
)

Source from the content-addressed store, hash-verified

1265
1266
1267def is_potential_multi_index(
1268 columns: Sequence[Hashable] | MultiIndex,
1269 index_col: bool | Sequence[int] | None = None,
1270) -> bool:
1271 """
1272 Check whether or not the `columns` parameter
1273 could be converted into a MultiIndex.
1274
1275 Parameters
1276 ----------
1277 columns : array-like
1278 Object which may or may not be convertible into a MultiIndex
1279 index_col : None, bool or list, optional
1280 Column or columns to use as the (possibly hierarchical) index
1281
1282 Returns
1283 -------
1284 bool : Whether or not columns could become a MultiIndex
1285 """
1286 if index_col is None or isinstance(index_col, bool):
1287 index_columns = set()
1288 else:
1289 index_columns = set(index_col)
1290
1291 return bool(
1292 len(columns)
1293 and not isinstance(columns, ABCMultiIndex)
1294 and all(isinstance(c, tuple) for c in columns if c not in index_columns)
1295 )
1296
1297
1298def dedup_names(

Callers 5

readMethod · 0.90
readMethod · 0.90
_parseMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected