I have an excel files with four sheets (2016_data, 2017_data, 2018_data and 2019_data). Column C of all these sheets is the weight of a product. I want to use an array such as below that includes the bin breakpoints. breakpoints_1=[1, 300, 1000]
NOTE: The break points array size is not known. Sometimes it could have 10 points, and sometimes just 2 points. (Example: breakpoints_2= [1, 4, 7, 523,650, 1700]
Now I want to classify the data of each of above sheets based on the above array.
If we use breakpoints_1, then the results will be:
2016_data_1=df_2016[(df_2016["weight"]>=1) & (df_2016["weight"]<300)]
2016_data_2=df_2016[(df_2016["weight"]>=300) & (df_2016["weight"]<1000)]
2017_data_1=df_2017[(df_2017["weight"]>=1) & (df_2017["weight"]<300)]
2017_data_2=df_2017[(df_2017["weight"]>=300) & (df_2017["weight"]<1000)]
2018_data_1=df_2018[(df_2018["weight"]>=1) & (df_2018["weight"]<300)]
2018_data_2=df_2018[(df_2018["weight"]>=300) & (df_2018["weight"]<1000)]
2019_data_1=df_2019[(df_2019["weight"]>=1) & (df_2019["weight"]<300)]
2019_data_2=df_2019[(df_2019["weight"]>=300) & (df_2019["weight"]<1000)]