WIP warn if parsing with du_parse by MarcoGorelli · Pull Request #47828 · pandas-dev/pandas (original) (raw)
The issue is that in
df = DataFrame(
[[1, 2], [3, 4]],
columns=date_range("1/1/2013", "1/2/2013"),
index=["A", "B"],
)
df.index.name = name
with tm.assert_produces_warning(warn):
result = df.reset_index()
, resetting the index will try to insert an element into a datetime index. hence, it'll try to parse the new element as a date, and this'll trigger the new warning
There's currently no way of catching multiple warnings, so perhaps that should be addressed first
EDIt: passing multiple warnings as a tuple works fine