Skip to content

pivot_wider() requires names_from but the docs say it shouldn't #1508

@wjandrea

Description

@wjandrea

Brief Description

According to the docs, this should be allowed:

janitor.pivot_wider(df)

However, it raises:

ValueError: pivot_wider() is missing 1 required argument: 'names_from'

System Information

  • Operating system: Linux
  • OS details (optional): Debian 12 (Bookworm)
  • Python version (required): 3.11

Minimally Reproducible Code

I don't think it's important what the df argument is, so you can just use a null one:

import janitor

janitor.pivot_wider(pd.DataFrame())

Error Messages

Traceback (most recent call last):

  Cell In[23], line 1
    janitor.pivot_wider(pd.DataFrame())

  File ~/micromamba/envs/anaconda3_11_plus/lib/python3.11/site-packages/janitor/utils.py:335 in emit_warning
    return func(*args, **kwargs)

  File ~/micromamba/envs/anaconda3_11_plus/lib/python3.11/site-packages/janitor/functions/pivot.py:2059 in pivot_wider
    return _computations_pivot_wider(

  File ~/micromamba/envs/anaconda3_11_plus/lib/python3.11/site-packages/janitor/functions/pivot.py:2106 in _computations_pivot_wider
    ) = _data_checks_pivot_wider(

  File ~/micromamba/envs/anaconda3_11_plus/lib/python3.11/site-packages/janitor/functions/pivot.py:2250 in _data_checks_pivot_wider
    raise ValueError(

ValueError: pivot_wider() is missing 1 required argument: 'names_from'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions