MCPcopy
hub / github.com/dask/dask / meta_warning

Function meta_warning

dask/dataframe/core.py:410–434  ·  view source on GitHub ↗

Provide an informative message when the user is asked to provide metadata

(df: Any, method: str)

Source from the content-addressed store, hash-verified

408
409
410def meta_warning(df: Any, method: str) -> str:
411 """
412 Provide an informative message when the user is asked to provide metadata
413 """
414 if is_dataframe_like(df):
415 meta_str: object = {k: str(v) for k, v in df.dtypes.to_dict().items()}
416 elif is_series_like(df):
417 meta_str = (df.name, str(df.dtype))
418 else:
419 meta_str = None
420 msg = (
421 "\nYou did not provide metadata, so Dask is running your "
422 "function on a small dataset to guess output types. "
423 "It is possible that Dask will guess incorrectly.\n"
424 "To provide an explicit output types or to silence this message, "
425 f"please provide the `meta=` keyword, as described in the {method} function "
426 f"that you are using."
427 )
428 if meta_str:
429 msg += (
430 "\n"
431 f" Before: .{method}(func)\n"
432 f" After: .{method}(func, meta={meta_str}\n"
433 )
434 return msg
435
436
437def _convert_to_numeric(series, skipna):

Callers 5

mapMethod · 0.90
applyMethod · 0.90
mapMethod · 0.90
applyMethod · 0.90
mapMethod · 0.90

Calls 4

is_dataframe_likeFunction · 0.90
is_series_likeFunction · 0.90
to_dictMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…