ENH: Import testing into main namespace. by jseabold · Pull Request #6188 · pandas-dev/pandas (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation14 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@jseabold

Unfortunately I won't be able to use this in production until 2020 when we require 0.14, but this would make some things a bit easier for projects that use pandas as a library.

@jseabold

@jreback

what r u going to use this for?

@jseabold

Testing without an extra import and using the make* functions interactively for examples, bug-reporting, etc.

@jseabold

E.g., we need the pandas test function for testing DataFrame equality.

Incidentally, I started to add to this suite some useful functions (DataFrame approximately equal and allclose) until I found that these functions are undocumented and most are written in Cython. Will have to stick to 3+ function calls to test until I find some time for a PR.

@jreback

@jseabold

For precision issues cf. np.testing.assert_allclose. Would be a good target. I don't know what array_equivalent is.

Hmm, equals is an interesting addition. Still nice to keep testing functions in the test namespace, though right?

@jreback

equals is not really for testing (though it may be used that way). Its a first class function; comparing frames with nans for equality is not possibly right now (without the expressions equals uses); and object arrays are a disaster. see the examples.

why do you want to import testing to the main namespace, can't you import into statsmodels ? (if that's where you are using I assume)

@jseabold

Numpy imports testing into the main namespace, and I got tired of typing two imports for pandas everywhere. Also for bug reporting. Everyone comes up with there own pd.DataFrame(np.random.random.... Would be simple to just point people to pd.util.testing.make* functions. What's the harm? The kitchen sink is already imported in the __init__ and it doesn't add another actual namespace to the main one.

@jreback

ok...np then....do you want in 0.13.1 (ok with me)...if so go ahead and merge

@jseabold

Thanks. Doesn't really matter to me. I'm usually on dev version, and like I said I won't ever actually be able to use this in production until our min version is wherever it ends up (which feels like never these days...).

@jreback

ok...let's wait for 0.14 then

@ghost

@jseabold , I thought you were an academic. What constitutes "production"? is there
a GMM capture-the-flag colloquium you run or something?

@jreback

@jseabold don't you want to do (in __init__)

from pandas.utils import testing as testing

as I presume them you want to do

panel = pd.testing.makePanel()

?

@jseabold

I was leaving it in the util namespace so that the changes are really very minimal, but flat is better than nested, and I'm fine with it if y'all are.

@jreback

jreback added a commit that referenced this pull request

Feb 18, 2014

@jreback

ENH: Import testing into main namespace.

Labels

2 participants

@jseabold @jreback