let datetime = frame.column("datetime_nano")?.cast(&DataType::Datetime(TimeUnit::Nanoseconds, None))?;
let date = datetime.cast(&DataType::Date)?;
let time = datetime.cast(&DataType::Time)?;
println!("{}", datetime);
println!("{}", date);
The date part display
between date
and datetime
is not equal. Is there any way to get the correct date series ?
I have read the datetime.date()
function. just only solve dtype == DateType::Date
.
#[cfg(feature = "dtype-date")]
pub fn date(&self) -> PolarsResult<&DateChunked> {
match self.dtype() {
DataType::Date => unsafe {
Ok(&*(self.as_ref() as *const dyn SeriesTrait as *const DateChunked))
},
dt => Err(PolarsError::SchemaMisMatch(
format!("Series of dtype: {dt:?} != Date").into(),
)),
}
}