Skip to content

Fixing issue #4902. #4904

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

Merged
merged 1 commit into from
Sep 21, 2013
Merged

Fixing issue #4902. #4904

merged 1 commit into from
Sep 21, 2013

Conversation

alefnula
Copy link
Contributor

closes #4902, Added a check for complex numbers.

@cpcloud
Copy link
Member

cpcloud commented Sep 20, 2013

@alefnula Can you add a test if you aren't doing that already? Thanks :)

@jreback
Copy link
Contributor

jreback commented Sep 20, 2013

release notes as well!

@cpcloud
Copy link
Member

cpcloud commented Sep 20, 2013

@alefnula just fyi those are in doc/source/release.rst

@alefnula
Copy link
Contributor Author

Uh sorry, I'm not that familiar with the pandas project workflow yet. Can someone point me what should I add to release notes, and in which test suite/test file should the test for pandas.core.nanops._ensure_numeric go? The function is also private for the module and I don't see it used anywhere else, so should I test it directly or using just the public api.

I'm really sorry for this many questions. :-/

@cpcloud
Copy link
Member

cpcloud commented Sep 20, 2013

@alefnula No problem.

  1. As I said above, release notes are in pandas/doc/source/release.rst
  2. Test it on something similar to the SO question, e.g., create a heterogeneously typed DataFrame and compute the mean. Something like,
def test_complex_mean(self):
    df = DataFrame({'a': tm.choice(['a', 'b'], size=10), 'b': rand(10).astype(complex) + randn(10) * 1j})
    result = df.mean().item()
    expected = df['b'].values.mean()
    self.assertEqual(result, expected)

@alefnula
Copy link
Contributor Author

@cpcloud OK got it. One more question. test_series.py - is this an appropriate place for this test? Since this happens on every aggregate operation on a Series object.

@jreback
Copy link
Contributor

jreback commented Sep 20, 2013

@alefnula yes...can put it there....try to find a similar group of tests and try it (note that make sure its NOT under SafeForSparse), because I don't think this works on sparse

@alefnula
Copy link
Contributor Author

@jreback I just found a test_ensure_int32 int test_common.py. Maybe this is a better place for test_ensure_numeric since it's testing the exact change?

@jreback
Copy link
Contributor

jreback commented Sep 20, 2013

@alefnula that's fine too

@jreback
Copy link
Contributor

jreback commented Sep 20, 2013

@alefnula do you have travis hookup up? see contributing.md for instructions...

@alefnula
Copy link
Contributor Author

Added tests, updated the release.rst.

@alefnula
Copy link
Contributor Author

@jreback Enabled travis. But saw your post too late, already pushed the changes. :-/

@jreback
Copy link
Contributor

jreback commented Sep 20, 2013

go ahead and set up travis, then

git commit --amend -C HEAD
will trigger travis with a new commit hash

@alefnula alefnula closed this Sep 20, 2013
@alefnula alefnula reopened this Sep 20, 2013
@alefnula
Copy link
Contributor Author

@jreback Succeeded :) Than you and @cpcloud for assistance. :)

@jreback
Copy link
Contributor

jreback commented Sep 20, 2013

looks good....pls rebase and squash to 1 commit and should be mergeable

@alefnula alefnula closed this Sep 20, 2013
@cpcloud
Copy link
Member

cpcloud commented Sep 20, 2013

no need to close ....

@cpcloud cpcloud reopened this Sep 20, 2013
@alefnula
Copy link
Contributor Author

@cpcloud I'm haven't closed it. Github automatically closed it when I rebased and pushed.

@cpcloud
Copy link
Member

cpcloud commented Sep 20, 2013

strange

@jtratner
Copy link
Contributor

yeah, that's not supposed to happen at all. very weird.

@cpcloud
Copy link
Member

cpcloud commented Sep 20, 2013

wonder if the commit message has naything to do with it?

@alefnula
Copy link
Contributor Author

It happened two times... When I did the amend and when I rebased :-/

@cpcloud
Copy link
Member

cpcloud commented Sep 21, 2013

that's very weird since "fixing" is not one of the words that closes an issue

Extended _ensure_numeric to check if the value is a complex numbers.
Also it now tries to convert the value to a complex number if conversion to float fails.
Added PyDev project files to .gitignore.
@alefnula alefnula closed this Sep 21, 2013
@alefnula alefnula reopened this Sep 21, 2013
@jreback jreback merged commit 75a916a into pandas-dev:master Sep 21, 2013
@jreback
Copy link
Contributor

jreback commented Sep 21, 2013

thanks!

@alefnula alefnula deleted the iss4902 branch September 21, 2013 12:26
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.

_ensure_numeric does not check for complex numbers
4 participants