Giter Site home page Giter Site logo

Comments (4)

MarcoGorelli avatar MarcoGorelli commented on June 4, 2024 1

thanks for the report

the docs say

Time zone of the resulting Datetime data type. Only takes effect if the output column is of type Datetime.

furthermore

In a future version of Polars, date_range will always return a Date.

so, this argument will just be removed from date_range eventually

For now, the suggestion

Or at a minimum, there should be an error when time zones are specified and the output would be a date.

sounds good

from polars.

mcrumiller avatar mcrumiller commented on June 4, 2024

In your first example, you're using date_range to construct a Datetime series, which is explicitly warned against in the docs:

Deprecated since version 0.19.3: In a future version of Polars, date_range will always return a Date. Please use datetime_range() if you want a Datetime instead.

Both of your cases look correct to me. In the first case, New York uses EST, and your output is labeled EST.

The second "incorrect" case also look correct to me. When converting from datetime to date, the time zone is completely irrelevant: Dec 31 at 23:59 is still Dec 31 regardless of what time zone you're in. You're starting on Jan 1, incrementing by 2 days at a time, up until the 3rd. So you get the 1st and the 3rd.

Edit: I see, the error is that you expect a datetime here.

from polars.

Wainberg avatar Wainberg commented on June 4, 2024

@MarcoGorelli sounds good!

from polars.

stinodego avatar stinodego commented on June 4, 2024

This will all be taken care of in the scheduled deprecation. We should not make changes to deprecated functionality if not absolutely necessary.

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.