We would like to learn about your use case. For example, if this feature is needed to adopt Narwhals in an open source project, could you please enter the link to it below?
https://anam-org.github.io/metaxy/main/
Please describe the purpose of the new feature or describe the problem to solve.
I would like to make an empty Narwhals frame that looks exactly like another one, but doesn't hold any data.
I couldn't find a way to do it naturally, something like:
df = nw.empty_like(another_df)
With Polars, it is possible to pass an empty data structure and a schema when constructing a new DataFrame:
df = pl.DataFrame([], schema=schema)
With Narwhals it would make less sense, because implementations should be aware of the original data source (e.g. with Ibis where to SELECT from). So I imagine with Narwhals we would need to actually use another DataFrame instance that's already valid, hence the .empty_like suggestion.
Or, alternatively, DataFrame.empty().
Suggest a solution if possible.
No response
If you have tried alternatives, please describe them below.
An alternative right now is doing .head(0) on an existing DataFrame.
Additional information that may help us understand your needs.
No response