List handling

List handling#

2025-05-05

21 min read time

Applies to Linux

Series.list can be used to access the values of the series as lists and apply list methods to it. These can be accessed like Series.list.<function/property>.

Series.list

List methods for Series

astype(dtype)

Return a new list Series with the leaf values casted to the specified data type.

concat([dropna])

For a column with at least one level of nesting, concatenate the lists in each row.

contains(search_key)

Returns boolean values indicating whether the specified scalar is an element of each row.

index(search_key)

Returns integers representing the index of the search key for each row.

get(index[, default])

Extract element at the given index from each list in a Series of lists.

leaves

From a Series of (possibly nested) lists, obtain the elements from the innermost lists as a flat Series (one value per row).

len()

Computes the length of each element in the Series/Index.

sort_values([ascending, inplace, kind, ...])

Sort each list by the values.

take(lists_indices)

Collect list elements based on given indices.

unique()

Returns the unique elements in each list.