Questions tagged [bins]
235 questions
2
votes
1 answer
Is there a built in way, using pandas, to find the amount of values below a threshold for bins?
Sorry if the title is confusing I am new to pandas and tried to be as concise as possible. Basically I have a dataframe I'm reading in and for each of the attributes in the data frame I need to quantize them to nearest 2 value by rounding. My…

dmb1o3
- 21
- 2
2
votes
2 answers
How to arrange bins in stacked histogram, Python
I am working on a code of a stacked histogram and I need help arranging the bins in the order if this is possible.
0.01 - 0.1, 0.1 - 0.5, 0.5 - 1.0, 1.0 - 2.5, > 2.5
Right now, my histogram looks like this:
with the order of bins being:
0.01 -…

Fred
- 103
- 7
2
votes
2 answers
I have been trying to qcut an array of values into 4 bins. I am getting the error below? How to solve this I am a beginner in Python
Below is my array data:
wkx_old['Sales point'].values
array([ 2, 2, 2, 4, 4, 3, 1, 4, 2, 1, 3, 4, 1, 1, 4, 7, 4,
1, 1, 2, 4, 3, 4, 3, 3, 2, 5, 2, 3, 2, 3, 4, 2, 10,
4, 4, 6, 3, 3, 1, 1, 2, 1, 3, 2, 4, 5, …

Adarsh Rai
- 33
- 1
- 4
2
votes
1 answer
What is the alternate of numpy.digitize() function in Julia?
I would like to know, how may I replicate the numpy.digitize() functionality in julia?
I am trying to convert this python example to Julia.
Python Example
x = np.array([0.2, 6.4, 3.0, 1.6])
bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0])
inds =…

Mohammad Saad
- 1,935
- 10
- 28
2
votes
1 answer
How can I get the same bin size for both groups in a histogram? (Julia)
I have two data sets and i want to plot them in a histogram. I want to have the same bin size for both of them, is there an easy way to do it?
(Julia)

jvm.97
- 247
- 1
- 7
2
votes
1 answer
Pandas Q-cut: Binning Data using an Expanding Window Approach
This question is somewhat similar to a 2018 question I have found on an identical topic.
I am hoping that if I ask it in a simpler way, someone will be able to figure out a simple fix to the issue that I am currently facing:
I have a timeseries…

john_mon
- 487
- 1
- 3
- 13
2
votes
0 answers
Smooth histogram in python
In my program, I calculate N amounts of three parameters and want to create three histograms for each parameter. I have strict conditions for the histograms. Firstly, it is a condition on the range (at some points histogram should go to zero…

Алексей Мохов
- 29
- 1
- 2
2
votes
3 answers
How to randomly divide interval into non overlapping, spaced bins of equal length
I have an interval from for example from 1 to 671. I would like to divide it into 5 random non-overlapping bins of length 50 but also spaced with min 51.
interval <- 1:671 (example, it does not need to be 671)
Result (this is an example as the…

fattel
- 133
- 6
2
votes
0 answers
How to make a weight array from a list of tuples in order to plot a histogram whose y axis is weighted?
I have a list of tuples as follows:
A=[(122208102.23250552, 34), (164096757.6449624, 4), (212275562.3177331, 72), (499344188.7213493, 240), (515347294.02090293, 2), (614044718.1056056, 4), (623878472.271997, 37), (1050993427.1862154, 2),…

Rebel
- 472
- 8
- 25
2
votes
2 answers
Dimension issue when using .apply(value_counts, bin=x)
I am trying to apply value_counts to the following dataframe using bins
df2 = pd.DataFrame(np.random.randint(0,100,size=(1000, 4)), columns=list('ABCD'))
df2.apply(pd.value_counts, normalize=True, bins=[0,25,50,75,101]).sort_values(by=['A'],…

Elias K.
- 513
- 1
- 4
- 12
2
votes
2 answers
Python: checking which bins two time points belong to
I have a list of lists with two values that represent a start time-point and an end time-point. I would like to count how much of the time range between the two points fall into bins.
The bins are between 0-300,300-500 and 500-1200.
I would also…

Timo Kvamme
- 2,806
- 1
- 19
- 24
2
votes
1 answer
How to change the colour of bins in ggplot (geom_bin2d) to reflect difference between density in that area and the average density across a dataset?
Say I have some data that looks a bit like this
library(ggplot2)
library(dplyr)
employee <- employee <- c('John','Dave','Paul','Ringo','George','Tom','Jim','Harry','Jamie','Adrian')
quality <- c('good', 'bad')
x = runif(4000,0,100)
y =…

Dave Snider
- 71
- 2
- 8
2
votes
1 answer
How to create a matrix based on bins?
I have a set of values ranging from 3-27, that have 20 finite values:
A = [(0,21),(1,12),(2,15),(3,3),(4,21),(5,15),(6,27),(7,21),(8,9),(9,27),(10,12),(11,9),(12,12),(13,3),(14,9),(15,12),(16,6),(17,3),(18,9),(19,15)]
I would like to learn how to…

Daniel
- 77
- 3
- 20
2
votes
1 answer
How do i get all the numbers of fft bins in a defined frequency band?
I use the matlab software. To my question.
I have a audio signal, on which i am applying a STFT. I take a segment
(46 ms, specifially chosen) out of my signal y(audio signal) and use a FFT on it. Then i go to the next segment, until to end of my…
user6281035
2
votes
0 answers
Creating bins dynamically in Tableu
I've got 50+ measures and I want to create histogram with binned data and switching displayed measures dynamically. I know how create bins manually but is there any possibility to create bins dynamically?

abcd
- 63
- 5