narwhals icon indicating copy to clipboard operation
narwhals copied to clipboard

docs: add docstring examples for dtypes

Open MarcoGorelli opened this issue 1 year ago • 4 comments

The dtypes don't currently have docstrings https://narwhals-dev.github.io/narwhals/api-reference/dtypes/

it would be good to add a docstring to each, perhaps even with an example of how to end up with that dtype pandas/polars/pyarrow

MarcoGorelli avatar Sep 27 '24 06:09 MarcoGorelli

I'll take that. Just found out that Polars documentation doesn't show examples for dtypes. And Pandas documentation has examples that look like:

>>>pd.BooleanDtype()
BooleanDtype

anopsy avatar Sep 27 '24 06:09 anopsy

hey @MarcoGorelli, I'd like to clarify what do you mean by "example how to end up with that dtype", do you mean - first using cast and then checking the series dtype, or just checking the dtype of series or a third secret thing? Btw do we want to implement Dataframe.dtypes ?

anopsy avatar Sep 27 '24 13:09 anopsy

i think any operation which produces that dtype is probably fine...e..g for boolean: nw.from_native(pd.Series([True, True, False]), series_only=True).dtype produces nw.Boolean

Dataframe.dtypes

not sure, there's already DataFrame.schema

MarcoGorelli avatar Sep 27 '24 13:09 MarcoGorelli

Thank you, that helps a lot!

anopsy avatar Sep 28 '24 08:09 anopsy

Only the following are left to be documented:

FBruzzesi avatar Dec 21 '24 08:12 FBruzzesi

Working on Int128 and UInt128

anopsy avatar Jan 03 '25 18:01 anopsy