Skip to content

What is the best way to read a pin from Posit Connect directly into polars? #233

Description

@SamEdwardes

What is the best way to read a pin from Posit Connect directly into polars?

I have found a few options that work, but none of them are exactly what I am looking for.

(1) Use pin_download

This method is my favourite, but it requires one extra step, I can't get a polars dataframe directly from pin_read.

import pins
import polars as pl

board = pins.board_connect()
paths = board.pin_download("sam.edwardes/vessel_verbose_raw")
pl.read_parquet(paths)

(2) Use pandas

This works, but requires me to have pandas installed. I also assume there is some kind of performance hit b/c you first read into pandas, then into polars?

import pins
import pandas as pd
import polars as pl

board = pins.board_connect()
pl.DataFrame(board.pin_read("sam.edwardes/vessel_verbose_raw"))

(3) Use fsspec

I have not figured out how to implement this yet, but I found this example for duckdb:

#193

Is there a way to do this with polars?

Related issues

Suggestions

It would be nice if pins gave me a choice about what DataFrame library is used with pin_read. For example:

import pins
import polars as pl

board = pins.board_connect()
board.pin_read("sam.edwardes/vessel_verbose_raw", df_library='polars')

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions