Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): construct timestamps from dates + times #10101

Open
1 task done
deepyaman opened this issue Sep 12, 2024 · 0 comments
Open
1 task done

feat(api): construct timestamps from dates + times #10101

deepyaman opened this issue Sep 12, 2024 · 0 comments
Labels
feature Features or general enhancements

Comments

@deepyaman
Copy link
Contributor

deepyaman commented Sep 12, 2024

Is your feature request related to a problem?

I am frustrated by the difficulty of creating a timestamp column, given a date column and a time column.

What is the motivation behind your request?

I have two columns, utc_date and utc_time. I want to create a utc_timestamp column. The most straightforward way seems to be to do:

ibis.timestamp(
    utc_date.year(),
    utc_date.month(),
    utc_date.day(),
    utc_time.hour(),
    utc_time.minute(),
    utc_time.second(),
)

This is both verbose and (potentially) inefficient, given it extracts components from each column, only to recombine them.

Alternatives aren't that great; in the end, I was able to concat utc_date and utc_time as strings, and as_timestamp() that; alternatively, maybe it would work to construct an interval from utc_time and add that (again, timestamp math feels unnecessary for this).

I'm just trying to think how this would work in practice, and if backends actually implement this construction (don't think BigQuery does, for example).

Describe the solution you'd like

ibis.timestamp(utc_date, utc_time)  # or ibis.timestamp.from_date_and_time(utc_date, utc_time) ?

What version of ibis are you running?

9.3.0ish

What backend(s) are you using, if any?

DuckDB

Code of Conduct

  • I agree to follow this project's Code of Conduct
@deepyaman deepyaman added the feature Features or general enhancements label Sep 12, 2024
@deepyaman deepyaman changed the title feat(expr): construct timestamp from date and time feat(api): construct timestamps from dates + times Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Features or general enhancements
Projects
Status: backlog
Development

No branches or pull requests

1 participant