BUG: fix NDFrame.as_blocks() for sparse containers by immerrr · Pull Request #6748 · pandas-dev/pandas (original) (raw)
I've decided to separate this into a separate comment.
Which brings me to another topic, minimalism in API design. I mean, I tend to share the opinion that an API is perfect not when you can't add anything else but rather when you can't take anything from it. It happens quite often that an interface gets overburdened with those small details, e.g. it just hurts my eyes to wade through numpy.ndarray attrs/methods when I forget the exact spelling of the thing I want to use and I know is there:
In [1]: np.arange(10)
Out[1]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
In [2]: _1.
_1.T _1.choose _1.data _1.flatten _1.nbytes _1.repeat _1.sort _1.tostring
_1.all _1.clip _1.diagonal _1.getfield _1.ndim _1.reshape _1.squeeze _1.trace
_1.any _1.compress _1.dot _1.imag _1.newbyteorder _1.resize _1.std _1.transpose
_1.argmax _1.conj _1.dtype _1.item _1.nonzero _1.round _1.strides _1.var
_1.argmin _1.conjugate _1.dump _1.itemset _1.prod _1.searchsorted _1.sum _1.view
_1.argsort _1.copy _1.dumps _1.itemsize _1.ptp _1.setfield _1.swapaxes
_1.astype _1.ctypes _1.fill _1.max _1.put _1.setflags _1.take
_1.base _1.cumprod _1.flags _1.mean _1.ravel _1.shape _1.tofile
_1.byteswap _1.cumsum _1.flat _1.min _1.real _1.size _1.tolist
And, unfortunately, pandas containers add more on top of that:
In [1]: pd.Series()
Out[1]: Series([], dtype: float64)
In [2]: _1.
Display all 225 possibilities? (y or n)
The desire to have a bit of everything at your fingertip is tempting indeed, but 225 (two hundred!!) methods and properties is a bit too many for my liking. And it is a lot to wrap your head around when you're only starting.