Table 1 has many rows 20k+ with a column that has values A742, A821, J334 etc.
Table 2 has somewhere between 10-100 rows with each row having a low and high value represeting a range:
|A454|A562|
|J332|J440|
|J443|J448|
I need an efficient way to filter table 1 rows if their values are within any of the ranges in table 2. The ranges do not overlap in table 2. If needed you can assume the tables are sorted, as based on the broader structure of what I’m doing I can sort the tables once and then will have to preform this operation about 20-30 times.
Struggling to figure out an efficient solution, thanks!
Edit: Fixed table layout, kinda.
submitted by /u/macster71
[link] [comments]
r/learnpython Table 1 has many rows 20k+ with a column that has values A742, A821, J334 etc. Table 2 has somewhere between 10-100 rows with each row having a low and high value represeting a range: |A454|A562| |J332|J440| |J443|J448| I need an efficient way to filter table 1 rows if their values are within any of the ranges in table 2. The ranges do not overlap in table 2. If needed you can assume the tables are sorted, as based on the broader structure of what I’m doing I can sort the tables once and then will have to preform this operation about 20-30 times. Struggling to figure out an efficient solution, thanks! Edit: Fixed table layout, kinda. submitted by /u/macster71 [link] [comments]
Table 1 has many rows 20k+ with a column that has values A742, A821, J334 etc.
Table 2 has somewhere between 10-100 rows with each row having a low and high value represeting a range:
|A454|A562|
|J332|J440|
|J443|J448|
I need an efficient way to filter table 1 rows if their values are within any of the ranges in table 2. The ranges do not overlap in table 2. If needed you can assume the tables are sorted, as based on the broader structure of what I’m doing I can sort the tables once and then will have to preform this operation about 20-30 times.
Struggling to figure out an efficient solution, thanks!
Edit: Fixed table layout, kinda.
submitted by /u/macster71
[link] [comments]