Questions tagged [bins]
235 questions
0
votes
1 answer
Grouping values into custom bins
I have a data frame with an 'education' attribute. Values are discrete, 1-16. For purposes of cross-tabulation, I want to bin this 'education' variable but with custom bins (1:8, 9:11, 12, 13:15, 16).
I've been fooling around with pd.cut() but I…

immaprogrammingnoob
- 167
- 2
- 13
0
votes
0 answers
Plotting equal number of points in equal number of bins and averaging bin values
I have a list of points. I want to put an equal number of points in an equal number of bins in a histogram. Ideally it would not be hard coded so in the future I could have uneven amounts of points in any number of bins.
Then I want to find the…
user12149858
0
votes
0 answers
python matplotlib hist not showing missing bin properly
I have a dataframe that is constructed with numbers from 1 to 16, but without number 15.
df = pd.DataFrame({'rand_int_no_15':[random.choice([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16]) for cnt in range(100) ]})
Now I would like to…

user3225309
- 1,183
- 3
- 15
- 31
0
votes
1 answer
How to calculate the number of queues needed in a box classification/packaging problem?
I need to size a box classification system where boxes get on a queue until the packaging quantity is reached. Then they all leave the queue at a fixed rate.
This is done real time with production. I can estimate the volume for each SKU but I can't…

Alex
- 13
- 5
0
votes
0 answers
Creating a Column for Bins in DF based on numerical column
I have a df that looks like,
ID | Time_A | Time_B
B 5.0 3.5
C 3.0 4.0
A 2.5 1.0
I want to create a new column that classifies Time_B column into Bins of 0-5, 5-10, 10-15, 15-20, and 20 - anything larger. Where none of the…

Chris90
- 1,868
- 5
- 20
- 42
0
votes
2 answers
plt.hist() with extremes as "minor than x", "grater than y"
Here is the example:
v = np.random.randint(low=-15,high=15,size=20)
plt.hist(v,bins=[-10,-5,0,5,10])
plt.show()
now, I would like to set the bins like ["minor than -10", -10, -5, 0, 5, 10, "greater than 10"].
How to do it?

user9187374
- 299
- 1
- 3
- 11
0
votes
1 answer
How do I make my histogram of unequal bins show properly?
My data consists of the following:
Majority numbers < 60, and then a few outliers that are in the 2000s.
I want to display it in a histogram with the following bin ranges:
0-1, 1-2, 2-3, 3-4, ..., 59-60, 60-max
import numpy as np
import…

K Split X
- 3,405
- 7
- 24
- 49
0
votes
1 answer
How a corrupted double linked list error is detected in malloc?
I don't understand a condition for gettint the error - corrupted double-linked list (not small) -
There is a point in the program where it crashes due to corrupted double-linked list (not small).
At this moment, I don't want to know why it…

Sebastian Chimal
- 11
- 3
0
votes
0 answers
How to fix pandas.cut() gettin NaN
Before running pd.cut() my array has values of 0.0 -0.25 0.25 0.50 ... etc
after running pd.cut() my array has NaN NaN ... etc
I know the problem has to do with how I setup my bins.
I have tried both of the code segments below:
bins = (2, 0.0 ,…

DroidWizard
- 25
- 1
- 7
0
votes
1 answer
Value_counts doesnot divide in interval
Even though I used bin my dataframe is not getting split into interval. Its gets split into a list.
Is it because of my version? I use Spyder Python-3.6
pressures = df.Pressure.value_counts(bins=10,dropna=True).index.values
pressures Out[505]: …
0
votes
2 answers
How to create bins in R
I have a data frame named cst with columns country, ID, and age. I want to make bins for age (divide all ID's into deciles or quartiles) for each separate country. I used this way:
cut(cst[!is.na(cst$age), "age"], quantile(cst["age"], probs =…

Giedrius Urbonas
- 83
- 9
0
votes
0 answers
bins - Categorize column values using bins for ages
I have a .CSV file a snippet of which looks like this:
ID,SN, Age,Gender,Item ID,Item Name, Price
0,Lisim78, 20, Male, 108, Extraction Quickblade, 3.53
1,Lisovynya38, 40, Male, 143, Frenzied Scimitar, …

Krithika Raghavendran
- 457
- 3
- 10
- 25
0
votes
1 answer
How to count non-zeroes values using binned_statistic
I need to efficiently process very large 1D arrays extracting some statistics per bin and I have found very useful the function binned_statistic from scipy.stats as it includes a 'statistic' argument that works quite efficiently.
I would like to…

Mastodon
- 131
- 12
0
votes
1 answer
Converting numerical column values into bins in python
I am a newbie in python programming for data science. I was trying to convert numerical column values into bins with the code below:
bins = [12, 24, 48, 60, np.inf]
names = ['Tenure_12', 'Tenure_24', 'Tenure_48', 'Tenure_60']
telco['tenure_bin'] =…

Sarang123
- 33
- 1
- 1
- 10
0
votes
1 answer
Manipulating data into histogram like bins
I would like to change the format of my data for some specific code that I am working on. Below are the first 50 observations and the format it is in, each individual has its own line with the observation number, species, length (mm), weight (kg),…

fishy_stats
- 7
- 3