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

Function meta_warning

dask/dataframe/core.py:409–433  ·  view source on GitHub ↗

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

(df, method="apply")

Source from the content-addressed store, hash-verified

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