Skip to content

DOC: read_excel dtype_backend default or no default? #62807

@simonaubertbd

Description

@simonaubertbd

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

Hello,
I was reading read_excel documentation https://pandas.pydata.org/docs/reference/api/pandas.read_excel.html

Documentation problem

And something is not clear to me
At first we have
pandas.read_excel(io, sheet_name=0, *, header=0, names=None, index_col=None, usecols=None, dtype=None, engine=None, converters=None, true_values=None, false_values=None, skiprows=None, nrows=None, na_values=None, keep_default_na=True, na_filter=True, verbose=False, parse_dates=False, date_parser=<no_default>, date_format=None, thousands=None, decimal='.', comment=None, skipfooter=0, storage_options=None, dtype_backend=<no_default>, engine_kwargs=None)

So I understand there is no default value for dtype_backend

and a few lines below

dtype_backend{‘numpy_nullable’, ‘pyarrow’}, default ‘numpy_nullable’

    Back-end data type applied to the resultant [DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html#pandas.DataFrame) (still experimental). Behaviour is as follows:

        "numpy_nullable": returns nullable-dtype-backed [DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html#pandas.DataFrame) (default).

So here I understand the numpy_nullable is the default.

And finally, when reading the code https://github.com/pandas-dev/pandas/blob/v2.3.3/pandas/io/excel/_base.py#L451-L537

dtype_backend: DtypeBackend | lib.NoDefault = lib.no_default,

Suggested fix for documentation

Correct this part

dtype_backend{‘numpy_nullable’, ‘pyarrow’}, default ‘numpy_nullable’

    Back-end data type applied to the resultant [DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html#pandas.DataFrame) (still experimental). Behaviour is as follows:

        "numpy_nullable": returns nullable-dtype-backed [DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html#pandas.DataFrame) (default).

To

dtype_backend{‘numpy_nullable’, ‘pyarrow’}, no default

    Back-end data type applied to the resultant [DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html#pandas.DataFrame) (still experimental). Behaviour is as follows:

        "numpy_nullable": returns nullable-dtype-backed [DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html#pandas.DataFrame).

It's better because it's true ;)
Best regards,

Simon

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions