ERR: missing stacklevel in to_dict UserWarning · Issue #16927 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@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