Can I make pandas cut/qcut function to return with bin endpoint or bin midpoint instead of a string of bin label?
Currently
pd.cut(pd.Series(np.arange(11)), bins = 5)
0 (-0.01, 2]
1 (-0.01, 2]
2 (-0.01, 2]
3 (2, 4]
4 (2, 4]
5 (4, 6]
6 (4, 6]
7 (6, 8]
8 (6, 8]
9 (8, 10]
10 (8, 10]
dtype: category
with category / string values. What I want is
0 1.0
1 1.0
2 1.0
3 3.0
4 3.0
with numerical values representing edge or midpoint of the bin.