Relative Content

Tag Archive for pandasdataframegroup-by

Dynamic grouping of columns, using groupby

So I have 2 columns in a pandas dataframe, which are float values. I wanted to group the median values of the 2nd column based on the ranges in the first column (used pd.df.groupby). So I started with uniform ranges, such that if the first column’s values have a range of 20 to 40, so I group them in bins of size 2 (using np.linspace). But the resulting distribution table is not so informative to me, as the sizes are not distributed uniformly.