Description
Code Sample, a copy-pastable example if possible
Using DataFrame.set_index
as an example, but this applies to other methods that take an inplace kwarg:
# The following work
df.set_index('foo', drop=0)
df.set_index('foo', append='yes please')
df.set_index('foo', verify_integrity=22.7)
# This doesn't
df.set_index('foo', inplace=1)
The last line raises ValueError: For argument "inplace" expected type bool, received type int.1
Problem description
This behaviour seems inconsistent.
Expected Output
The last line should proceed successfully with inplace treated as True
.
Or every boolean kwarg should be type-checked, though I like this option much less. I think using 0/1 as shorthand for True/False is a pretty common idiom.
It looks like this is the result of a somewhat recent 'bug fix': #14189. To me, it feels like a regression.
Output of pd.show_versions()
pandas: 0.20.1
pytest: None
pip: 9.0.1
setuptools: 36.0.1
Cython: None
numpy: 1.12.1
scipy: 0.19.0
xarray: None
IPython: 5.4.1
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: None
tables: 3.3.0
numexpr: 2.6.2
feather: None
matplotlib: 2.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.4.1
html5lib: 0.9999999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None