Giter VIP home page Giter VIP logo

Comments (3)

BGR360 avatar BGR360 commented on June 28, 2024

Same problem in 0.20.28:

lf = pl.LazyFrame({
    "duration": [1000, 2000, 3000]
}, schema={"duration": pl.Duration})

print(lf.select(pl.col('duration').min()).collect())
thread '<unnamed>' panicked at crates/polars-core/src/datatypes/any_value.rs:811:19:
cannot create date from other type. dtype: 1ms
---------------------------------------------------------------------------
PanicException                            Traceback (most recent call last)
Cell In[33], line 5
      1 lf = pl.LazyFrame({
      2     "duration": [1000, 2000, 3000]
      3 }, schema={"duration": pl.Duration})
----> 5 print(lf.select(pl.col('duration').min()).collect())

File ~/scratch/oplogs-demo/.venv/lib/python3.8/site-packages/polars/lazyframe/frame.py:1817, in LazyFrame.collect(self, type_coercion, predicate_pushdown, projection_pushdown, simplify_expression, slice_pushdown, comm_subplan_elim, comm_subexpr_elim, no_optimization, streaming, background, _eager, **_kwargs)
   1814 # Only for testing purposes atm.
   1815 callback = _kwargs.get("post_opt_callback")
-> 1817 return wrap_df(ldf.collect(callback))

PanicException: cannot create date from other type. dtype: 1ms

from polars.

BGR360 avatar BGR360 commented on June 28, 2024

Might this be the bug?

fn min_reduce(&self) -> PolarsResult<Scalar> {
let sc = self.0.min_reduce();
let v = sc.value().as_duration(self.0.time_unit());
Ok(Scalar::new(
self.dtype().clone(),
v.as_duration(self.0.time_unit()),
))
}

.as_duration() is called twice.

from polars.

BGR360 avatar BGR360 commented on June 28, 2024

Or perhaps AnyValue::as_duration() should just be fixed to handle the case where self is already AnyValue::Duration

from polars.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.