Binning using Python Pandas (pd.cut)

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

pretty straight foward, just what i needed thank you!

luisurena
Автор

Awsome content....expalined well...thanks from Bangalore.

shaikusman
Автор

SImple and straight to the point, thanks a lot

bintangmuhammad
Автор

what is np.info?? sometimes using at the end of bins list like pd.cut(housing['median_income'], bins=[0., 1.5, 3.0, 4.5, 6., np.info()], labels=[1, 2, 3, 4, 5])
Thanks

alialtntas
Автор

Say you have a DataFrame with local_dttm, measure_x, and measure_y. Your goal is to find out how much time was spent in the bins. Where bins are based on the values of x and y. How would you do this.

I tried the following:
time_spent = df.groupby(pd.cut(df["measurement_x"], bins=[0, 100, 200, 300, 400]))["local_dttm"]

time_spent.sum()

but I keep getting an error since local_dttm is a timeseries. How do I solve this?

samanthafranco
Автор

can we have bins defined by pandas using the Information Value maximization function

vivekjain
Автор

doesnt work when you have a value 0 in your age column

vidyanshudas