MCPcopy
hub / github.com/ray-project/ray / _is_cudf_dataframe

Function _is_cudf_dataframe

python/ray/data/block.py:134–148  ·  view source on GitHub ↗

Check if the object is a cudf.DataFrame (lazy import). Checks ``sys.modules`` first to avoid importing cudf (which loads CUDA and ~1.5 GiB of RSS) when it hasn't been imported yet. If cudf is not in ``sys.modules``, no object in the process can be a cudf DataFrame.

(obj: Any)

Source from the content-addressed store, hash-verified

132
133
134def _is_cudf_dataframe(obj: Any) -> bool:
135 """Check if the object is a cudf.DataFrame (lazy import).
136
137 Checks ``sys.modules`` first to avoid importing cudf (which loads CUDA
138 and ~1.5 GiB of RSS) when it hasn't been imported yet. If cudf is not
139 in ``sys.modules``, no object in the process can be a cudf DataFrame.
140 """
141 if "cudf" not in sys.modules:
142 return False
143 try:
144 import cudf
145
146 return isinstance(obj, cudf.DataFrame)
147 except ImportError:
148 return False
149
150
151def _is_empty_schema(schema: Optional[Schema]) -> bool:

Callers 3

_validate_batch_outputFunction · 0.90
__next__Method · 0.90
batch_to_blockMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…