Getting data for histogram plot

This is a post about a super quick-and-dirty way to create a histogram in MySQL for numeric values. There are multiple other ways to create histograms that are better and more flexible, using CASE statements and other types of complex logic. This method wins me over time and time again since it’s just so easy … Read more

Binning a column with pandas

You can use pandas.cut: bins = [0, 1, 5, 10, 25, 50, 100] df[‘binned’] = pd.cut(df[‘percentage’], bins) print (df) percentage binned 0 46.50 (25, 50] 1 44.20 (25, 50] 2 100.00 (50, 100] 3 42.12 (25, 50] bins = [0, 1, 5, 10, 25, 50, 100] labels = [1,2,3,4,5,6] df[‘binned’] = pd.cut(df[‘percentage’], bins=bins, labels=labels) print … Read more

Histogram using gnuplot?

yes, and its quick and simple though very hidden: binwidth=5 bin(x,width)=width*floor(x/width) plot ‘datafile’ using (bin($1,binwidth)):(1.0) smooth freq with boxes check out help smooth freq to see why the above makes a histogram to deal with ranges just set the xrange variable.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)