x=[1 ,1 ,4, 4, 5 ,7, 7, 7, 9]
res=pd.cut(x,bins=4,include_lowest=True)
#[(0.991, 3.0], (0.991, 3.0], (3.0, 5.0], (3.0, 5.0], (3.0, 5.0], (5.0, 7.0], (5.0, 7.0], (5.0, 7.0], (7.0, 9.0]]
ret=st.mode(res)
#odeResult(mode=array([Interval(3.0, 5.0, closed='right')], dtype=object), count=array([3]))
originalChargeMode = ((ret[0][0]).left + (ret[0][0]).right) / 2
#4