-
Notifications
You must be signed in to change notification settings - Fork 184
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
In #1942 I mentioned a desire to keep the package size down. One way to do this is by reducing overly-long docstrings.
Here are some general guidelines:
- The examples should be clear and to-the-point
- Most docstrings should just be:
- import dataframe library (usually pandas, pyarrow, or duckdb)
- import narwhals
- construct native dataframe. Make it as small as possible: 2 rows and 2 columns should be plenty for most docstrings
- call
nw.from_nativeand apply operation - only show a single example
- Variety between docstrings is encouraged, they don't all need to follow the same exact template. They can use different libraries, some can end with
to_native, some can use selectors ornw.all...this is all OK. Just keep it minimal - Essential functionality (such as DataFrame.filter, DataFrame.with_columns, DataFrame.select), it's OK to have even 2-3 examples showing different ways to use it
- For examples which use null values, use a library with proper support for them (i.e. not pandas with classical data types). Such docstrings should also link to the pandas null handling page
Also, the reason many of the current docstrings are so long is because that's how I'd originally encouraged them to be. I think that was a mistake on my part, I need to acknowledge this, and as the project has evolved, it's time to revisit
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation