You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importpandasaspd__to_str=lambdax: ''ifpd.isnull(x) ==Trueelsestr(x)
# Let's say that the excel to be read has a column with some empty strings or nulls in them# by default na_filter is Truedf=pd.read_excel('./file1.xlsx', converters= {'Name': __to_str}) # -> Leads to empty strings being read as nan# when na_filter is Falsedf=pd.read_excel('./file1.xlsx', converters= {'Name': __to_str}, na_filter=False) # -> Leads to empty strings be read as empty strings (according to __to_str function)
Why this behaviour?
I believe that if there's an explicitly provided argument(converters), its behaviour should override any other argument that has not been set(has a default value -> na_filter), in case of such conflict or overlap of effect arises.
Expected output
When one argument is specified which operates at a certain specificity level, the other arguments having default values should give in to the effect caused by the explicitly set one.
For instance, if converters is provided with a function to handle cell values of a certain column, then na_filter or keep_default_na values which are applied by default and have not been passed explicitly.
Please correct me if my understanding is incorrect.
Please consider the code below.
Why this behaviour?
I believe that if there's an explicitly provided argument(
converters
), its behaviour should override any other argument that has not been set(has a default value ->na_filter
), in case of such conflict or overlap of effect arises.Expected output
When one argument is specified which operates at a certain specificity level, the other arguments having default values should give in to the effect caused by the explicitly set one.
For instance, if
converters
is provided with a function to handle cell values of a certain column, thenna_filter
orkeep_default_na
values which are applied by default and have not been passed explicitly.Please correct me if my understanding is incorrect.
Output of
pd.show_versions()
commit : None
pandas : 1.0.0
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 45.1.0
Cython : 0.29.14
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 1.2.7
lxml.etree : 4.5.0
html5lib : None
pymysql : None
psycopg2 : 2.7.7 (dt dec pq3 ext lo64)
jinja2 : 2.11.1
IPython : 7.12.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.5.0
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : 1.3.13
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : 1.2.7
numba : None
The text was updated successfully, but these errors were encountered: