Reputation: 3824
I have pandas.Panel4D object and I would like to find the maximum of the all values.
The current way:
p4d.max().max().max().max()
In there a better way to achieve the same result?
(np.max(p4d) does not work.)
Also is there is an equivalent for idxmax for panel and panel4D?
Upvotes: 2
Views: 107
Reputation: 294338
Use max
on the values
attribute.
pd.Panel4D(np.arange(16).reshape(2, 2, 2, 2)).values.max()
15
numpy ndarray
max
method returns the maximum over the entire structure unless you specify an axis. You can access the underlying ndarray
via the values
attribute.
Upvotes: 2