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

Better treatment for complex numbers #1098

Closed
wants to merge 6 commits into from
Closed

Conversation

tkf
Copy link
Contributor

@tkf tkf commented Apr 20, 2012

This fixes #1083. I checked that the number of failing tests (SKIP=38, errors=5, failures=34) do not increase with these change sets.

BTW, in form_blocks why not simply do

    if float_dict:
        ...

instead of calculating length?:

    if len(float_dict):
        ...

@tkf
Copy link
Contributor Author

tkf commented Apr 20, 2012

Oops I have NOSE_DOCTEST_TESTS=t and NOSE_WITH_DOCTEST=t and that's why I had failing tests. There is no fail/error when I remove these envvars.

tkf added 2 commits April 21, 2012 04:49
It looks like sorting by dtype itself does not work.
To see that, try this snippet:

>>> from numpy import dtype
>>> sorted([dtype('bool'), dtype('float64'), dtype('complex64'),
...         dtype('float64'), dtype('object')])
[dtype('bool'),
 dtype('float64'),
 dtype('complex64'),
 dtype('float64'),
 dtype('object')]
@tkf
Copy link
Contributor Author

tkf commented Apr 21, 2012

The bug I fixed in bae8155 is very serious one and it could have effect even without complex number implementation I added. It is probably a bug in numpy. Try the following code and observe sorting fails. I checked with numpy 1.6.1.

>>> from numpy import dtype
>>> sorted([dtype('bool'), dtype('float64'), dtype('complex64'),
...         dtype('float64'), dtype('object')])
[dtype('bool'),
 dtype('float64'),
 dtype('complex64'),
 dtype('float64'),
 dtype('object')]

@tkf
Copy link
Contributor Author

tkf commented Apr 21, 2012

BTW, I am using complex64 here but it should be complex128, right?
I noticed just now.

@wesm
Copy link
Member

wesm commented May 14, 2012

Yes, should be complex128

@wesm
Copy link
Member

wesm commented May 15, 2012

Merged this in. Should make a sweep and change complex64 -> complex128 at some point, though

@wesm wesm closed this May 15, 2012
tkf added a commit to tkf/pandas that referenced this pull request May 16, 2012
wesm pushed a commit that referenced this pull request May 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataFrame stores complex number as object sometimes
2 participants