The result for a maximum value of the first column in panel is
maximum value of first column is ; Column1 1.377292
Solution
To solve this, we will follow the below approach −
Set data value as dictionary key is ‘Column1’ with value as pd.DataFrame(np.random.randn(5, 3))
data = {'Column1' : pd.DataFrame(np.random.randn(5, 3))}
Assign data to Panel and save it as p
p = pd.Panel(data)
Print the column using dict key Column1
print(p['Column1'])
Calculate the maximum value of first column using, minor_xs(0) ,
p.minor_xs(0).max()
Example
Let’s see the following code to get a better understanding −
import pandas as pd import numpy as np data = {'Column1' : pd.DataFrame(np.random.randn(5, 3))} p = pd.Panel(data) print("Panel values:") print(p['Column1']) print("maximum value of first column is:") print(p.minor_xs(0).max())
Output
Panel values: 0 1 2 0 0.914209 -0.665899 -0.703097 1 -1.375634 -0.164529 -0.673326 2 1.377292 0.692793 0.390777 3 -0.899618 -1.163681 0.954463 4 0.025898 0.832265 0.173535 maximum value of first column is: Column1 1.377292 dtype: float64