Description
Is there a reason that .rename
doesn't raise if keys are supplied that don't exist? This caught me out a couple of times:
In [14]: import pandas as pd
In [15]: df=pd.DataFrame({'a': [1,2], 'b': [3,4]})
In [16]: df
Out[16]:
a b
0 1 3
1 2 4
In [17]: df.rename(columns={'a': 'c'})
Out[17]:
c b
0 1 3
1 2 4
# ok
In [18]: df.rename(columns={'d': 'c'})
Out[18]:
a b
0 1 3
1 2 4
# this should raise?