-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Clarify 'public-ish' API for packages using pandas. #5460
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
Comments
+1 on making those ones you mention public right now, and esp. things which subclasses may rely on. |
OK, let me give two concrete examples of new types of indices I'd like to be able to integrate with pandas:
On a related note: I can't even make this second type of index convert properly when used as the argument of
(Of course, my Index wrapper is neither an actual |
…an Index This allows custom ndarray-like objects which aren't actual ndarrays to be smoothly cast to a pandas.Index: pandas-dev#5460 (comment)
Thanks for the quick merge with #7270! That provides an immediate fix: my "index wrappers" (my case 2) can now be converted into real |
It turns out that the ndarray-like arrays of dtype datetime64 were not being properly cast to an Index, because -- due to a bug with np.datetime64 -- calling np.asarray(x, dtype=object) if x is an ndarray of type datetime64 results in an *integer* array. This PR adds tests and a work around to pd.Index.__new__. Related pandas-dev#5460
I think https://pandas.pydata.org/pandas-docs/stable/reference/index.html satisfies describing what is public. Closing, but happy to reopen if things need clarifying |
I've been contributing a little bit to GeoPandas / working on some of my own custom code using pandas that I want to share with others and I realized that I wasn't sure what is and is not part of the public API for pandas.
Here's what I have in my head:
Definitely public:
_
classmethods on NDFrameSomewhat public:
union
,intersection
,difference
,levels
,labels
,names
(and the set methods for them)get_indexer
,get_indexer_non_unique
,groupby
,get_loc
,slice_locs
,equals
,identical
,values
propertyis_
,is_unique
, lexsort properties on MIget_offset
andDateOffset
subclassesNice to make public right now:
compat
module (useful to provide this for modules that depend on pandas...at least in terms of guaranteeing that whatever's in the namespace now will go through a deprecation period).cache_readonly
decoratorInternal methods/properties that subclasses may rely on/manipulate:
__finalize__
_metadata
property_constructor
,_constructor_sliced
_internal_names
(maybe - weird behavior with__setattr__
if you don't do this)_reset_cache
,_update_inplace
, possibly_maybe_update_cacher
Things we could consider making public in the future:
is_*
methods in core/common.Am I missing anything here? Does this make sense?
The text was updated successfully, but these errors were encountered: