Is it only me or the description of dask.dataframe.from_pandas() function is misleading?

So function declaration looks like this:

dask.dataframe.from_pandas(data: pandas.core.frame.DataFrame, npartitions: int | None = None, chunksize: int | None = None, sort: bool = True, name: str | None = None)

Then in the code:

if (npartitions is None) == (chunksize is None):
raise ValueError(“Exactly one of npartitions and chunksize must be specified.”)

nrows = len(data)

if chunksize is None:
    if not isinstance(npartitions, int):
        raise TypeError(
            "Please provide npartitions as an int, or possibly as None if you specify chunksize."
elif not isinstance(chunksize, int):
    raise TypeError(
        "Please provide chunksize as an int, or possibly as None if you specify npartitions."

So are they or not optional?

Hi @nor-mal, welcome to Dask Discourse,

As you’ve noticed, you should provide either one or the other to the from_pandas function. Both are optional, but one must be set.

Maybe the documentation could be improved and this information given somewhere in the API documentation and not as an exception. Would you like to propose a PR for this?