polars.Series.to_init_repr#
- Series.to_init_repr(n: int = 1000) str [source]#
Convert Series to instantiable string representation.
- Parameters:
- n
Only use first n elements.
Examples
>>> s = pl.Series("a", [1, 2, None, 4], dtype=pl.Int16) >>> print(s.to_init_repr()) pl.Series('a', [1, 2, None, 4], dtype=pl.Int16) >>> s_from_str_repr = eval(s.to_init_repr()) >>> s_from_str_repr shape: (4,) Series: 'a' [i16] [ 1 2 null 4 ]