Skip to content

ENH: Import testing into main namespace. #6188

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
Feb 18, 2014

Conversation

jseabold
Copy link
Contributor

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.

@jreback
Copy link
Contributor

jreback commented Jan 30, 2014

what r u going to use this for?

@jseabold
Copy link
Contributor Author

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

@jseabold
Copy link
Contributor Author

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
Copy link
Contributor

jreback commented Jan 30, 2014

their is a new .equals function which should work for you (handles all the nan vs. nan issue)
(also array_equivalent for arrays); could be modified with a precision i think

http://pandas.pydata.org/pandas-docs/dev/whatsnew.html#api-changes

@jseabold
Copy link
Contributor Author

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
Copy link
Contributor

jreback commented Jan 30, 2014

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
Copy link
Contributor Author

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
Copy link
Contributor

jreback commented Jan 30, 2014

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

@jseabold
Copy link
Contributor Author

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
Copy link
Contributor

jreback commented Jan 30, 2014

ok...let's wait for 0.14 then

@ghost
Copy link

ghost commented Jan 31, 2014

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

@jreback
Copy link
Contributor

jreback commented Feb 16, 2014

@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
Copy link
Contributor Author

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
Copy link
Contributor

jreback commented Feb 18, 2014

@jseabold this is fine

jreback added a commit that referenced this pull request Feb 18, 2014
ENH: Import testing into main namespace.
@jreback jreback merged commit d1b2fc1 into pandas-dev:master Feb 18, 2014
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.

2 participants