8),
"b": np.random.rand(8),
"d": [1, 2.0, np.NaN, np.NaN, 0, -5, -42, None],
}
)...pl.lit(False))
.alias("conditional"),
)
print(df_conditional)
Casting
类型转换(Casting)将列的底层 DataType 转换为新的数据类型...cast 方法包括一个 strict 参数,该参数确定当 Polars 遇到无法从源 DataType 转换为目标 DataType 的值时的行为。...另一方面,如果 strict=False,无法转换为目标 DataType 的任何值都将悄悄地转换为 null。...0),
datetime(2020, 1, 1, 9, 2, 0),
datetime(2020, 1, 1, 9, 4, 0),