Skip to content

Commit

Permalink
Revert refactor of pl$DataFrame() with schema only (#926)
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher authored Mar 16, 2024
1 parent afbb94c commit 720af6a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/dataframe__frame.R
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,10 @@ pl_DataFrame = function(..., make_names_unique = TRUE, schema = NULL) {
# no args create empty DataFrame
if (length(largs) == 0L) {
if (!is.null(schema)) {
out = lapply(schema, \(dtype) pl$Series(NULL)$cast(dtype)) |>
pl$select()
largs = lapply(seq_along(schema), \(x) {
pl$lit(numeric(0))$cast(schema[[x]])$alias(names(schema)[x])
})
out = pl$select(largs)
} else {
out = .pr$DataFrame$default()
}
Expand Down

0 comments on commit 720af6a

Please sign in to comment.