
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Write a program in Python to create a panel from a dictionary of dataframe and print the maximum value of the first column
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
- Related Articles
- Write a Python program to find the average of first row in a Panel
- Write a Python program to trim the minimum and maximum threshold value in a dataframe
- Write a program in Python to print the ‘A’ grade students’ names from a DataFrame
- Write a program in Python to print the length of elements in all column in a dataframe using applymap
- Write a Python program to find the maximum value from first four rows in a given series
- Write a program in Python to covert the datatype of a particular column in a dataframe
- Write a program in Python to find the lowest value in a given DataFrame and store the lowest value in a new row and column
- Write a program in Python to find the minimum rank of a particular column in a dataframe
- Python - Calculate the maximum of column values of a Pandas DataFrame
- How to create Python dictionary from the value of another dictionary?
- Python Program to print key value pairs in a dictionary
- Create a Pipeline and remove a column from DataFrame - Python Pandas
- Write a program in Python to print the first and last three days from a given time series data
- Python program to create a dictionary from a string
- Write a Python program to quantify the shape of a distribution in a dataframe

Advertisements