I convert the following df into bins using pd.cut in following:
import numpy as np
import pandas as pd
df = pd.DataFrame(np.random.randint(0,100,size=(5, 4)), columns=list('ABCD'))
print(df)
newDF = pd.cut(df.A, 2, precision=0)
print(newDF)
A B C D
0 83 43 99 85
1 6 57 44 45
2 5 72 10 53
3 24 50 23 18
4 75 25 96 27
0 (44.0, 83.0]
1 (5.0, 44.0]
2 (5.0, 44.0]
3 (5.0, 44.0]
4 (44.0, 83.0]
Is there any way to return the lower bound or upper bound of the range instead of the whole range? For example, from the above example:
0 44.0
1 5.0
2 5.0
3 5.0
4 44.0