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

Function add_path_column

dask/dataframe/io/json.py:317–324  ·  view source on GitHub ↗
(df, column_name, path, dtype)

Source from the content-addressed store, hash-verified

315
316
317def add_path_column(df, column_name, path, dtype):
318 if column_name in df.columns:
319 raise ValueError(
320 f"Files already contain the column name: '{column_name}', so the path "
321 "column cannot use this name. Please set `include_path_column` to a "
322 "unique name."
323 )
324 return df.assign(**{column_name: pd.Series([path] * len(df), dtype=dtype)})

Callers 2

read_json_chunkFunction · 0.85
read_json_fileFunction · 0.85

Calls 1

assignMethod · 0.80

Tested by

no test coverage detected