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

Function is_dataframe_like

dask/utils.py:1516–1529  ·  view source on GitHub ↗

Looks like a Pandas DataFrame

(df)

Source from the content-addressed store, hash-verified

1514
1515
1516def is_dataframe_like(df) -> bool:
1517 """Looks like a Pandas DataFrame"""
1518 if (df.__class__.__module__, df.__class__.__name__) == (
1519 "pandas.core.frame",
1520 "DataFrame",
1521 ):
1522 # fast exec for most likely input
1523 return True
1524 typ = df.__class__
1525 return (
1526 all(hasattr(typ, name) for name in ("groupby", "head", "merge", "mean"))
1527 and all(hasattr(df, name) for name in ("dtypes", "columns"))
1528 and not any(hasattr(typ, name) for name in ("name", "dtype"))
1529 )
1530
1531
1532def is_series_like(s) -> bool:

Callers 15

apply_and_enforceFunction · 0.90
_renameFunction · 0.90
meta_warningFunction · 0.90
clear_known_categoriesFunction · 0.90
check_metaFunction · 0.90
_check_daskFunction · 0.90
_maybe_sortFunction · 0.90
assert_dask_dtypesFunction · 0.90
meta_frame_constructorFunction · 0.90
meta_series_constructorFunction · 0.90
_to_string_dtypeFunction · 0.90
_is_alignedFunction · 0.90

Calls 2

allFunction · 0.85
anyFunction · 0.85

Tested by 2

test_is_dataframe_likeFunction · 0.72