Skip to content

ENH: error message context. #61834

Open
Open
@hunterhogan

Description

@hunterhogan

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

I wish I had more information when troubleshooting exceptions.

Traceback (most recent call last):
  File "c:\apps\astToolFactory\astToolFactory\_datacenterDataframe.py", line 413, in <module>
    updateDataframe()
    ~~~~~~~~~~~~~~~^^
  File "c:\apps\astToolFactory\astToolFactory\_datacenterDataframe.py", line 377, in updateDataframe
    dataframe = _getDataFromStubFile(dataframe)
  File "c:\apps\astToolFactory\astToolFactory\_datacenterDataframe.py", line 144, in _getDataFromStubFile
    dataframe = dictionary2UpdateDataframe(getDictionary_match_args(), dataframe)
  File "c:\apps\astToolFactory\astToolFactory\_datacenterDataframe.py", line 342, in dictionary2UpdateDataframe
    dataframe.loc[getMaskByColumnValue(dataframe, columnValueMask), assign.column] = assign.value
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\apps\astToolFactory\.venv\Lib\site-packages\pandas\core\indexing.py", line 911, in __setitem__
    iloc._setitem_with_indexer(indexer, value, self.name)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\apps\astToolFactory\.venv\Lib\site-packages\pandas\core\indexing.py", line 1942, in _setitem_with_indexer
    self._setitem_with_indexer_split_path(indexer, value, name)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "C:\apps\astToolFactory\.venv\Lib\site-packages\pandas\core\indexing.py", line 1998, in _setitem_with_indexer_split_path
    raise ValueError(
    ...<2 lines>...
    )
ValueError: Must have equal len keys and value when setting with an iterable

Feature Description

Concrete information

Please print any available concrete information.

For example, pseudocode:

message = f"Must have equal {len(keys)=} and {len(value)=} when setting with an iterable"
raise ValueError(message)

Error message for a user

Please write the error message as an English sentence.

(what?) Must have equal len (length) keys and (length) value when setting (what?) with an iterable (.)

Alternative Solutions

Grammar checker.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions