Questions tagged [bins]
235 questions
2
votes
2 answers
How to bin data based on values in one column, and count occurrences from another column excluding duplicates in R?
I have a file of r-values for correlations. I want to split the r-values into bins and count how many CNVs are in each bin. Is there a way to do this without the duplicates?
GeneChr SNP SNP_Position CNV start end …

Nev
- 117
- 9
2
votes
2 answers
histogram with varying bin widths
I am trying to replicate the concept of chart Fig 1 from the following paper (http://dx.doi.org/10.1016/j.envsci.2011.08.004):
It is a histogram whose bin widths vary dependent upon the value of x and whose height depends on variable y. The…

Expat_Canuck
- 113
- 8
2
votes
1 answer
Equivalent of histc function in R?
Is there an equivalent function in R to the matlab function histc?
Vector and bins are numeric.
[ countInBin, binIndexOfVectorElement ] = histc( vector, bins )
where:
bins = min(vector) : increment : max( vector )
and
length(…

BLevy
- 61
- 5
2
votes
3 answers
Groupby bins and aggregate in R
I have data like (a,b,c)
a b c
1 2 1
2 3 1
9 2 2
1 6 2
where 'a' range is divided into n (say 3) equal parts and aggregate function calculates b values (say max) and grouped by at 'c' also.
So the output looks like
a_bin b_m(c=1) b_m(c=2)
1-3 …
user2517372
2
votes
1 answer
easy way to subset data into bins
I have a data frame as seen below with over 1000 rows. I would like to subset the data into bins by 1m intervals (0-1m, 1-2m, etc.). Is there an easy way to do this without finding the minimum depth and using the subset command multiple times to…

user1997414
- 189
- 3
- 10
1
vote
2 answers
Histogram() doesn't display the values at the edge of defined range
I can't get Julia to display edge values on histograms, when defining a range for the bins. Here is a minimal example:
using Plots
x = [0,0.5,1]
plot(histogram(x, bins=range(0,1,length=3)))
Defining them explicitly doesn't help…

capstain
- 85
- 1
- 9
1
vote
1 answer
Minitab Histogram: Group bins as "larger than X"
As I am new to Minitab, I searched for quite a while in blogs, forums, youtube videos and even images first, but no luck.
I am looking for a possibility to group values in a histogram (i.e. bins?). I have a large data set that looks like this:…

babylonia
- 11
- 4
1
vote
2 answers
Histogram from Pycharm
I'm trying to plot a histogram using Pycharm, but I get an error message: ValueError: bins must increase monotonically, when an array
import matplotlib.pyplot as plt
x = [19.5, 23.5, 31.5, 35.5, 39.5, 39.5, 43.5, 47.5]
y = [58.1, 23.3, 9.3, 4.7,…

Herman Mokgope
- 11
- 2
1
vote
1 answer
Recode or bin multiple numeric columns as categorical values and summing the counts
I want to recode or bin multiple numeric columns as categorical values and summing the counts. The columns are ages by individual year from 18yrs to 90+ yrs with the cells containing summed totals by age. I want to create categories to reflect age…

db2020
- 69
- 8
1
vote
1 answer
lightgbm.basic.LightGBMError: bin size 1141 cannot run on GPU
I am using lihgtgbm GPU for training, and the error "[LightGBM] [Fatal] bin size 1141 cannot run on GPU" is prompted. The error is "lightgbm.basic.LightGBMError: bin size 1141 cannot run on GPU".
[LightGBM] [Warning] Categorical features with more…

hawaii412824
- 11
- 2
1
vote
1 answer
Changing variable labels/legend in raster plot to discrete characters
I have just made a plot using raster data that consists of 6 different land types and fit them to polygon vectors. I'm trying to change the values on the continuous scale bar (1-6) to the names of each landtype (e.g. grasslands, urban, etc) which is…

Alex White
- 21
- 2
1
vote
1 answer
Using cut to create breaks that start at 0
how can i use the cut() function to create breaks that start at 0?
x <- seq(0, 102, length.out = 15)
cut(x, breaks = 10)
[1] (-0.102,10.2] (-0.102,10.2] (10.2,20.4] (20.4,30.6] (20.4,30.6] (30.6,40.8] (40.8,51] (40.8,51] (51,61.2] …

zimia
- 930
- 3
- 16
1
vote
0 answers
Python qcut: At precision = 1, my first bin has obnoxiously long decimal value for left boundary
The following code creates quartile columns with bins:
for(a, c) in zip(colnames, cols):
cstats[c] = pd.qcut(cstats[a], 4, precision = 1)
I understand that even with precision set to 1 decimal place, the leftmost bin adjusts to include the…

Joseph Shuffield
- 15
- 6
1
vote
2 answers
Pythonic way to classify a value to bin
I've went through multiple excamples of data classification however either I didn't get it or those are not applicable in my case.
I have a list of values:
values = [-130,-110,-90,-80,-60,-40]
All I need to do is to classify input integer value to…

morf
- 125
- 11
1
vote
0 answers
How to remove the overlapping in threshold_scale of Choropleth Map?
#ChoroplethMap
bins = list(state_avg_value["price"].quantile([0, 0.25, 0.5, 0.75, 1]))
#state_avg_value_max= state_avg_value['price'].max()
m = folium.Map(location=[48, -102], zoom_start=3)
folium.Choropleth(
…

user14479872
- 9
- 3