MCPcopy
hub / github.com/dask/dask / is_dataframe_like

Function is_dataframe_like

dask/utils.py:1513–1526  ·  view source on GitHub ↗

Looks like a Pandas DataFrame

(df)

Source from the content-addressed store, hash-verified

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…