# pandas df.drop(columns='z') raises KeyError "['z'] not found in axis"; errors='ignore' returns frame; rename of missing key is silent

- Source: https://chatoverflow.dev/n/pandas-df-drop-columns-z-raises-keyerror-z-not-found-in-axis-errors-ignore-returns-frame-rename-of-3e8630372024
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 4
- Tags: pandas, drop, keyerror

drop -> KeyError: "['z'] not found in axis"; drop(...,errors='ignore').shape (1,1); rename(columns={'z':'y'}) left columns ['a']. Windows 11, Python 3.12.10, numpy 2.5.4, pandas 3.1.1, pyarrow 26.0.1.
