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

Use correct random choice function in code snippet #12384

Closed
wants to merge 1 commit into from

Conversation

carroux
Copy link
Contributor

@carroux carroux commented Feb 18, 2016

A hidden code snippet uses tm.choice() when it should use np.random.choice()

A hidden code snippet uses `tm.choice()` when it should use `np.random.choice()`
@carroux
Copy link
Contributor Author

carroux commented Feb 18, 2016

cc @ellisonbg

@TomAugspurger
Copy link
Contributor

@carroux thanks!

@jreback jreback added this to the 0.18.0 milestone Feb 18, 2016
@jreback
Copy link
Contributor

jreback commented Feb 18, 2016

so I think this was for numpy < 1.7 compat.

pls remove this: https://github.com/pydata/pandas/blob/master/pandas/util/testing.py#L173

as well (its possible there are some other references as well), pls search the docs; in the code I think something will fail.

thanks!

@jreback jreback added the Clean label Feb 18, 2016
@jreback
Copy link
Contributor

jreback commented Feb 18, 2016

oh, saw @TomAugspurger merged this, ok. then.

@TomAugspurger
Copy link
Contributor

Ha, sorry bout that. FYI

pandas/tests/frame/test_query_eval.py
99:        a = tm.choice(['red', 'green'], size=10)
100:        b = tm.choice(['eggs', 'ham'], size=10)
152:        a = tm.choice(['red', 'green'], size=10)
153:        b = tm.choice(['eggs', 'ham'], size=10)
246:        a = tm.choice(['red', 'green'], size=10)
978:        a = Series(tm.choice(list('abcde'), 20))

pandas/tests/test_graphics_others.py
638:            gender = tm.choice(['male', 'female'], size=n)
712:            gender_int = tm.choice([0, 1], size=n)

pandas/tests/test_graphics.py
63:            gender = tm.choice(['Male', 'Female'], size=n)
64:            classroom = tm.choice(['A', 'B', 'C'], size=n)
3864:            gender = tm.choice(['male', 'female'], size=n)

pandas/tools/tests/test_merge.py
239:            df = DataFrame({'a': tm.choice(['m', 'f'], size=3),
241:            df2 = DataFrame({'a': tm.choice(['m', 'f'], size=10),
248:            df = DataFrame({'a': tm.choice(['m', 'f'], size=3),
251:            df2 = DataFrame({'a': tm.choice(['m', 'f'], size=10),
257:            df = DataFrame({'a': tm.choice(['m', 'f'], size=3),
259:            df2 = DataFrame({'a': tm.choice(['m', 'f'], size=10),

vb_suite/groupby.py
146:obj = tm.choice(list('ab'), size=n).astype(object)

are the other occurrences, if we want to open a cleanup issue.

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

Successfully merging this pull request may close these issues.

None yet

3 participants