I have a data set that is a ratio of 2 float type numbers. Some values have inf
for infinity (divide by zero) situation. How do I work with pd.qcut/pd.cut
with inf
values?
My data can be accessed here.
q = pd.qcut(df['ratio'], 10)
ValueError: Bin edges must be unique: array([ 1.20089207e+03, 6.02984295e+04, 1.26445577e+05,
2.29982770e+05, 5.13176079e+05, 1.28794976e+06,
4.96001538e+06, nan, nan,
nan, inf])
you could
replace
thenp.inf
withnp.nan
thendropna