Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Masked arrays with hard masks don't read as missing #24574

Closed
karldw opened this issue Jan 2, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@karldw
Copy link
Contributor

commented Jan 2, 2019

Code Sample, a copy-pastable example if possible

arr = np.ma.array([1.0, 2.0], mask=[True, False], dtype='float64')
arr_hard = np.ma.array([1.0, 2.0], mask=[True, False], dtype='float64', hard_mask=True)
print(pd.DataFrame(arr))
print(pd.DataFrame(arr_hard))

Normal masked array:

0
0 NaN
1 2.0

Hard masked array:

0
0 1.0
1 2.0

Problem description

I expected the output for a "hard" masked array to be the same as a regular masked array – I thought both would give NaN for the masked value. If the two cases behaved the same, it would be less surprising.

The issue is the same for Series as well as DataFrame, as well as other types of float.

Expected Output

Normal masked array: no change

Hard masked array:

0
0 NaN
1 2.0

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.7.1.final.0
python-bits: 64
OS: Linux
OS-release: 4.18.0-13-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.23.4
pytest: None
pip: 18.1
setuptools: 40.6.3
Cython: None
numpy: 1.15.4
scipy: None
pyarrow: None
xarray: None
IPython: 7.2.0
sphinx: None
patsy: None
dateutil: 2.7.5
pytz: 2018.7
blosc: None
bottleneck: None
tables: 3.4.4
numexpr: 2.6.8
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jan 2, 2019

we have minimal support for masked array conversions

welcome to have a PR to fix / test though

@karldw karldw referenced this issue Jan 3, 2019

Merged

Support hard-masked numpy arrays #24581

4 of 4 tasks complete

@jreback jreback added this to the 0.24.0 milestone Jan 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.