Open
Description
srs1
are some 1000 random numbers to be binned using the boundaries in absths
:
srs1 = pd.Series(np.random.uniform(low=0, high=3e-17, size=(1000,)))
absths = np.array([0., 1.e-22, 1.e-18, 1.e-16])
Bin them, print out the boundaries, and the results for the first 5 numbers in srs1
:
ncut1 = pd.cut(srs1,
bins=absths,
include_lowest=True,
precision=16,
retbins=True)
print(ncut1[1])
print(ncut1[0][:5])
gives
[ 0.00000000e+00 1.00000000e-22 1.00000000e-18 1.00000000e-16]
0 (1.0000000000000001e-18, 9.9999999999999998e-17]
1 (1.0000000000000001e-18, 9.9999999999999998e-17]
2 (1.0000000000000001e-18, 9.9999999999999998e-17]
3 (1.0000000000000001e-18, 9.9999999999999998e-17]
4 (1.0000000000000001e-18, 9.9999999999999998e-17]
dtype: category
Categories (3, object): [[0, 1] < (1, 1.0000000000000001e-18] < (1.0000000000000001e-18, 9.9999999999999998e-17]]
The boundary that is meant to be 1e-22
is displayed as 1
in Categories. The keyword argument precision
is already set to 16 to display many decimals. Is this a bug or am I not using the function correctly?
Thanks