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

Function concat

dask/dataframe/dask_expr/_collection.py:5403–5531  ·  view source on GitHub ↗

Concatenate DataFrames along rows. - When axis=0 (default), concatenate DataFrames row-wise: - If all divisions are known and ordered, concatenate DataFrames keeping divisions. When divisions are not ordered, specifying interleave_partition=True allows concatenate divisio

(
    dfs,
    axis=0,
    join="outer",
    ignore_unknown_divisions=False,
    ignore_order=False,
    interleave_partitions=False,
    **kwargs,
)

Source from the content-addressed store, hash-verified

5401
5402
5403def concat(
5404 dfs,
5405 axis=0,
5406 join="outer",
5407 ignore_unknown_divisions=False,
5408 ignore_order=False,
5409 interleave_partitions=False,
5410 **kwargs,
5411):
5412 """Concatenate DataFrames along rows.
5413
5414 - When axis=0 (default), concatenate DataFrames row-wise:
5415
5416 - If all divisions are known and ordered, concatenate DataFrames keeping
5417 divisions. When divisions are not ordered, specifying
5418 interleave_partition=True allows concatenate divisions each by each.
5419
5420 - If any of division is unknown, concatenate DataFrames resetting its
5421 division to unknown (None)
5422
5423 - When axis=1, concatenate DataFrames column-wise:
5424
5425 - Allowed if all divisions are known.
5426
5427 - If any of division is unknown, it raises ValueError.
5428
5429 Parameters
5430 ----------
5431 dfs : list
5432 List of dask.DataFrames to be concatenated
5433 axis : {0, 1, 'index', 'columns'}, default 0
5434 The axis to concatenate along
5435 join : {'inner', 'outer'}, default 'outer'
5436 How to handle indexes on other axis
5437 interleave_partitions : bool, default False
5438 Whether to concatenate DataFrames ignoring its order. If True, every
5439 divisions are concatenated each by each.
5440 ignore_unknown_divisions : bool, default False
5441 By default a warning is raised if any input has unknown divisions.
5442 Set to True to disable this warning.
5443 ignore_order : bool, default False
5444 Whether to ignore order when doing the union of categoricals.
5445
5446 Notes
5447 -----
5448 This differs in from ``pd.concat`` in the when concatenating Categoricals
5449 with different categories. Pandas currently coerces those to objects
5450 before concatenating. Coercing to objects is very expensive for large
5451 arrays, so dask preserves the Categoricals by taking the union of
5452 the categories.
5453
5454 Examples
5455 --------
5456 If all divisions are known and ordered, divisions are kept.
5457
5458 >>> import dask.dataframe as dd
5459 >>> a # doctest: +SKIP
5460 dd.DataFrame<x, divisions=(1, 3, 5)>

Callers 15

test_concat_strFunction · 0.90
test_concatFunction · 0.90
test_concat_pdfFunction · 0.90
test_concat_divisionsFunction · 0.90
test_invalid_joinsFunction · 0.90
test_concat_invalidFunction · 0.90
test_concat_one_objectFunction · 0.90
test_concat_simplifyFunction · 0.90

Calls 4

new_collectionFunction · 0.90
ConcatClass · 0.90
from_pandasFunction · 0.85
to_frameMethod · 0.45

Tested by 15

test_concat_strFunction · 0.72
test_concatFunction · 0.72
test_concat_pdfFunction · 0.72
test_concat_divisionsFunction · 0.72
test_invalid_joinsFunction · 0.72
test_concat_invalidFunction · 0.72
test_concat_one_objectFunction · 0.72
test_concat_simplifyFunction · 0.72