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

Add support for polars #20

Open
deanm0000 opened this issue Feb 22, 2024 · 4 comments
Open

Add support for polars #20

deanm0000 opened this issue Feb 22, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@deanm0000
Copy link

I think there's a really good synergy between display data tables and polars. Polars gives access to cloud data and to group by aggregations to only mention a few benefits.

Polars would be a good source especially for virtualized tables as they have lazy evaluation too.

@maccesch
Copy link
Collaborator

Oh this is an interesting one!

@maccesch maccesch added the enhancement New feature or request label Feb 22, 2024
@maccesch
Copy link
Collaborator

How exactly would you want to use it though? It still would have to be downloaded from somewhere, right?
At the moment the rows get downloaded and cached internally simply as a vec of struct instances.

@deanm0000
Copy link
Author

I'm thinking something like:

fn main() {
    mount_to_body(|| {
        let df = DataFrame::new(vec![
            Series::new("a",[1.0,2.0,3.0]),
            Series::new("b",[2.1,3.1,4.1]),
            Series::new("c",[0.0,1.2,2.2])
        ])
        .unwrap()

        view! {
            <table>
                <TableContent df />
            </table>
        }
    });
}

After looking at the paginated_rest_datasource, I think I can use the TableDataProvider to use a DataFrame. That said, I think polars would be a good synergy for if/when grouping is a feature that you'd support.

As a tangent, is there any way to have dynamically defined (not just types but the existence of) columns or can it only ever work with what's hard codes in a struct?

@maccesch
Copy link
Collaborator

I haven't tried to use it dynamically yet as this is not (yet?) the premise of this crate. But it could be possible if you implement TableDataProvideras well as TableRow manually without using the macro.

If get sth to work feel free to make a PR for a new example. Would be cool and could server as a basis for future development.

Grouping is certainly on the roadmap but probably not very soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants