# Pandas DataFrame – Maximum Value – max()

To find the maximum value of a Pandas DataFrame, you can use pandas.DataFrame.max() method. Using max(), you can find the maximum value along an axis: row wise or column wise, or maximum of the entire DataFrame.

## Example 1: Find Maximum of DataFrame along Columns

In this example, we will calculate the maximum along the columns. We will come to know the highest marks obtained by students, subject wise.

Python Program

``````import pandas as pd

mydictionary = {'physics': [68, 74, 77, 78],
'chemistry': [84, 56, 73, 69],
'algebra': [78, 88, 82, 87]}

# create dataframe
df_marks = pd.DataFrame(mydictionary)
print('DataFrame\n----------')
print(df_marks)

# calculate max along columns
mean = df_marks.max()
print('\nMaximum Value\n------')
print(mean)``````
Run

Output

``````DataFrame
----------
physics  chemistry  algebra
0       68         84       78
1       74         56       88
2       77         73       82
3       78         69       87

Maximum Value
------
physics      78
chemistry    84
algebra      88
dtype: int64``````

## Example 2: Find Maximum along Row

In this example, we will find the maximum along rows of the DataFrame. It results in finding the maximum marks obtained by the student for any subject.

Python Program

``````import pandas as pd

mydictionary = {'physics': [68, 74, 77, 78],
'chemistry': [84, 56, 73, 69],
'algebra': [78, 88, 82, 87]}

# create dataframe
df_marks = pd.DataFrame(mydictionary)
print('DataFrame\n----------')
print(df_marks)

# calculate max along columns
mean = df_marks.max(axis=1)
print('\nMaximum Value\n------')
print(mean)``````
Run

Output

``````DataFrame
----------
physics  chemistry  algebra
0       68         84       78
1       74         56       88
2       77         73       82
3       78         69       87

Maximum Value
------
0    84
1    88
2    82
3    87
dtype: int64``````

## Example 3: Maximum Value of complete DataFrame

In this example, we will find out the maximum value in a DataFrame irrespective of rows or columns.

In the previous examples, we have found maximum value along columns and rows respectively. Apply max() function to the result of the max() function in those cases. You will get the maximum of complete DataFrame.

Python Program

``````import pandas as pd

mydictionary = {'physics': [68, 74, 77, 78],
'chemistry': [84, 56, 73, 69],
'algebra': [78, 88, 82, 87]}

# create dataframe
df_marks = pd.DataFrame(mydictionary)
print('DataFrame\n----------')
print(df_marks)

# calculate max of whole DataFrame
mean = df_marks.max().max()
print('\nMaximum Value\n------')
print(mean)``````
Run

Output

``````DataFrame
----------
physics  chemistry  algebra
0       68         84       78
1       74         56       88
2       77         73       82
3       78         69       87

Maximum Value
------
88``````

### Summary

In this Pandas Tutorial, we have learned how to get maximum value of whole DataFrame, get maximum value of DataFrame along column(s) and obtain maximum value of DataFrame along rows.