pola-rs/polars · error
to_list not implemented for unknown
Error message
to_list not implemented for unknown
What it means
Guard in Series.to_list (python export): the series dtype is Unknown (e.g. from an unresolved lazy schema or dsl scan), for which no Python list conversion exists. Resolve the schema (collect with known dtypes) before exporting.
Source
Thrown at crates/polars-python/src/series/export.rs:161
iter: RepeatN<Option<u8>>,
n: usize,
}
impl Iterator for NullIter {
type Item = Option<u8>;
fn next(&mut self) -> Option<Self::Item> {
self.iter.next()
}
fn size_hint(&self) -> (usize, Option<usize>) {
(self.n, Some(self.n))
}
}
impl ExactSizeIterator for NullIter {}
PyList::new(py, NullIter { iter, n })?
},
DataType::Unknown(_) => {
panic!("to_list not implemented for unknown")
},
DataType::BinaryOffset => {
unreachable!()
},
DataType::Map(_, _) => {
let ca = series.map().map_err(PyPolarsErr::from)?;
PyList::new(py, ca.any_value_iter().map(Wrap))?
},
DataType::Extension(_, _) => {
return to_list_recursive(py, series.ext().unwrap().storage());
},
};
Ok(pylist.into_any())
}
to_list_recursive(py, series)
}
View on GitHub (pinned to 68506541d2)
Solutions
- Cast the Series to a concrete dtype before calling to_list(); 'unknown' columns come from empty/all-null data — give them a dtype via cast or schema.
Example fix
s = pl.Series('a', [], dtype=pl.Int64)
s.to_list() Defensive patterns
Strategy: fallback
When it happens
Trigger: Calling Series.to_list() on a Series of dtype Unknown.
Common situations: See trigger scenarios.
AI-assisted analysis of pola-rs/polars@68506541d2 (2026-08-19).
Data as JSON: /api/errors/cb61066a40b480be.
Report an issue: GitHub.