numpy can be used to extract maximal value from a histogram:
numpy
import numpy as np hist_data, _ = np.histogram(df['error'], bins='auto') ymax = max(hist_data)