Skip to content

Cell.first_not_none #799

@lars-reimann

Description

@lars-reimann

Is your feature request related to a problem?

When transforming a column of a table or computing a new one, it is sometimes beneficial to compute multiple values and pick the first that is not None. For example, we might try to transform a column that contains date strings in various formats into an actual date column.

Desired solution

Add a static method Cell.first_not_none. It should have one parameter cells: list[Cell] and return a new cell containing the first non-None cell value. The implementation should use the _LazyCell.

Use pl.coalesce internally.

Return None if all conversions returned None.

Possible alternatives (optional)

No response

Screenshots (optional)

No response

Additional Context (optional)

No response

Metadata

Metadata

Labels

releasedIncluded in a release

Type

No type

Projects

Status

✔️ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions