Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
API: add top-level functions as method #12640
Comments
jreback
added Reshaping API Design
labels
Mar 16, 2016
jreback
added this to the
0.18.1
milestone
Mar 16, 2016
jreback
modified the milestone: Next Major Release, 0.18.1
Apr 26, 2016
jreback
added the
Master Tracker
label
Jan 27, 2017
jreback
referenced
this issue
Jan 27, 2017
Closed
API cleanup: Remove global duplicates of DataFrame methods #15241
|
From the above list, Further, I don't think I find it necessary to deprecate those. Those are frequently used functions, so not sure it is worth deprecating them (which does not mean some of them would be valuable as a method as well). |
|
@jreback I'm interested in taking a stab at this, but since I've never toyed with The easiest way to port these to methods would be to simply thread a call to the globals from a method (akin to what is done in As I see it, the best option would be to instead move the core of each of the method bodies into a |
|
@ResidentMario conceptually this is very easy, (look at something like
BUT I didn't put a doc-string. And you cannot import things directly at the top-level in so here's a way to do this. create I think this is a nice pattern that will work. |
|
Ok, great, glad I asked! |
|
Line no. 186 in
Edit: actually it does generate a doc entry. Sphinx is more clever than I thought! So I think that |
|
Technically speaking, if reusing the original docstring is OK, this pattern could be used for all of the other conversions as well, since the files they are defined in already import that However I think that the old functions ought to get links to the new methods in their docstrings, and vice versa, and that the new methods ought to additionally get a In the case of @jreback what do you think? |
|
@ResidentMario yeah ok with having a standard way of doing this for doc-strings and such (so should fix So for how to do this, Ideally establish the pattern doing 1 or 2 methods, then in additional PR's can do the rest. IOW, can tweek to get the pattern that we want (and maybe make helpers / decorators to assist first). FYI, I have made a decorator e75eacb (see I am going to split this off and push to master shortly. (the decorator) |
This was referenced Feb 26, 2017
jreback
added a commit
that referenced
this issue
Apr 4, 2017
|
|
ResidentMario + jreback |
e50d397
|
linebp
added a commit
to linebp/pandas
that referenced
this issue
Apr 17, 2017
|
|
ResidentMario + linebp |
6ea1216
|
jreback commentedMar 16, 2016
•
edited
xref pydata#12578
so its pretty easy to add (and eventually deprecate) certain top-level functions that could/should be methods. Promotes a cleaner syntax and method chaining.
In 0.18.1 would propose adding these, deprecating in 0.19.0.
This would eliminate the ability to use directly with
np.ndarrays, but I view this is as a positive (note we effectively did this for the.rolling/expanding/ewmwithnp.ndarraysas well, though deprecated for a while).pd.crosstab(DataFrame)pd.melt(DataFrame) (PR #15521); added toDataFramepd.get_dummies(both)pd.cut/qcut(only on Series)