Skip to content

ma.mrecords not found #5577

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

Closed
dieterv77 opened this issue Nov 23, 2013 · 2 comments · Fixed by #5579
Closed

ma.mrecords not found #5577

dieterv77 opened this issue Nov 23, 2013 · 2 comments · Fixed by #5579
Labels
Milestone

Comments

@dieterv77
Copy link
Contributor

Running into the issue below with pandas master and numpy compiled from 1.8.x maintenance branch. If i do "import numpy.ma.mrecords" in ipython and try again, then creating the DataFrame works fine. Maybe the best thing to do is to add "import numpy.ma.mrecords" in core/frame.py?

import numpy.ma as ma
import pandas
x = ma.masked_all((3,4))
df = pandas.DataFrame(x)

AttributeError                            Traceback (most recent call last)
<ipython-input-4-8935d2e6ea81> in <module>()
----> 1 df = pandas.DataFrame(x)

C:\Python27\lib\site-packages\pandas-0.12.0_1147_g39ad4cb-py2.7-win-amd64.egg\pandas\core\frame.pyc in __init__(self, data, index, columns, dtype, copy)
    203 
    204             # masked recarray
--> 205             if isinstance(data, ma.mrecords.MaskedRecords):
    206                 mgr = _masked_rec_array_to_mgr(data, index, columns, dtype,
    207                                                copy)

AttributeError: 'module' object has no attribute 'mrecords'
@jreback
Copy link
Contributor

jreback commented Nov 23, 2013

this is very odd

in tests/test_frame.py

we have

import numpy.ma as ma
import numpy.ma.mrecords as mrecords

so the test works, it seems that the importing of mrecords changed the ma namespace (to
make mrecords exist)

@dieterv77 would you put up a PR to address this (you can do the import after ma.MaskedArray is checked)

@dieterv77
Copy link
Contributor Author

Yeah, i was a bit baffled but i figured i was missing something.
i'll make a PR sometime this weekend. thanks for looking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants