Pandas version checks

  • [X] I have checked that this issue has not already been reported.

  • [X] I have confirmed this bug exists on the latest version of pandas.

  • [X] I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
df = pd.DataFrame({"A": [0,1], "B": [0,1]})
df = df.convert_dtypes() # this line should help working with NA
df["C"] = df["A"] / df["B"]
df.dropna() # behavior in question

Output:

   A  B    C
0  0  0  NaN
1  1  1  1.0

Issue Description

According to docs, convert_dtypes() should be a better choice to work with NA data, but in the above example it makes column C with NA that cannot be dropped. Is it an expected behaviour? I believe it should work in the same way as if df is not dtypes converted?

Expected Behavior

import pandas as pd
df = pd.DataFrame({"A": [0,1], "B": [0,1]})
df["C"] = df["A"] / df["B"]
df.dropna() # correct behavior

Output:

   A  B    C
1  1  1  1.0

Installed Versions

INSTALLED VERSIONS ------------------ commit : 37ea63d540fd27274cad6585082c91b1283f963d python : 3.11.3.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19045 machine : AMD64 processor : Intel64 Family 6 Model 78 Stepping 3, GenuineIntel byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : English_United States.1251 pandas : 2.0.1 numpy : 1.24.3 pytz : 2023.3 dateutil : 2.8.2 setuptools : 66.0.0 pip : 23.0.1 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : None pandas_datareader: None bs4 : None bottleneck : None brotli : None fastparquet : None fsspec : None gcsfs : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyreadstat : None pyxlsb : None s3fs : None scipy : None snappy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.3 qtpy : None pyqt5 : None

Comment From: phofl

Hi, thanks for your report. This is expected for now and tied to the discussion about NA vs NaN in FloatingArrays