- Series.append(other: Series, append_chunks: bool = True) Series #
Append a Series to this one.
Series to append.
If set to True the append operation will add the chunks from other to self. This is super cheap.
If set to False the append operation will do the same as DataFrame.extend which extends the memory backed by this Series with the values from other.
Different from append chunks, extend appends the data from other to the underlying memory locations and thus may cause a reallocation (which are expensive).
If this does not cause a reallocation, the resulting data structure will not have any extra chunks and thus will yield faster queries.
Prefer extend over append_chunks when you want to do a query after a single append. For instance during online operations where you add n rows and rerun a query.
Prefer append_chunks over extend when you want to append many times before doing a query. For instance when you read in multiple files and when to store them in a single Series. In the latter case, finish the sequence of append_chunks operations with a rechunk.
>>> s = pl.Series("a", [1, 2, 3]) >>> s2 = pl.Series("b", [4, 5, 6]) >>> s.append(s2) shape: (6,) Series: 'a' [i64] [ 1 2 3 4 5 6 ]