You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [4]: pd.Series(np.arange(7))
Out[4]:
00112233445566dtype: int64# Let's put some limit on weekendsIn [5]: _4.clip_upper([3,3,3,3,3, 4,4])
---------------------------------------------------------------------------ValueErrorTraceback (mostrecentcalllast)
<ipython-input-5-3268c7bee292>in<module>()
---->1_4.clip_upper([3,3,3,3,3, 4,4])
/home/dshpektorov/sources/pandas/pandas/core/generic.pycinclip_upper(self, threshold)
2636clipped : sametypeasinput2637 """
-> 2638 if isnull(threshold):
2639 raise ValueError("Cannot use an NA value as a clip threshold")
2640ValueError: Thetruthvalueofanarraywithmorethanoneelementisambiguous. Usea.any() ora.all()
The text was updated successfully, but these errors were encountered:
What's the right idiom for allowing both scalars and vectors to pass here? isnull(3).any() won't work because False doesn't have an any method and calling as(any)array might make a copy we don't want (not actually sure about that). Could do use hasattr, or try/except, or even do an is check on False/True.
Basically, is there already a scalar/vector idiom for this?
I'd also like to note that pandas's df.any() aggregates across only one axis, while ndarray.any() aggregates the whole array regardless of dimensionality and shapes.
Here's what I mean:
The text was updated successfully, but these errors were encountered: