Skip to content

ERR: missing stacklevel in to_dict UserWarning #16927

Closed
@chris-b1

Description

@chris-b1

Code Sample, a copy-pastable example if possible

In [4]: df = pd.DataFrame([[1,2,3]], columns=['a', 'a', 'b'])

In [5]: df
Out[5]:
   a  a  b
0  1  2  3

In [6]: df.to_dict()
C:\<snip>\pandas\core\frame.py:891:
UserWarning: DataFrame columns are not unique, some columns will be omitted.
  "columns will be omitted.", UserWarning)
Out[6]: {'a': {0: 2}, 'b': {0: 3}}

Problem description

warning should specific stacklevel to warn at calling site, xref #9584

Metadata

Metadata

Assignees

No one assigned

    Labels

    Error ReportingIncorrect or improved errors from pandas

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions