python - Quick slicing of a dataframe using another dataframe in pandas -


i have 2 dataframes in pandas. df "a" contains start , end indexes of zone names. df "b" contains start , end indexes of subzones. goal extract subzones of zones.

example:

a:   start index | end index | zone name  -----------------------------------    1         |  10       |    x  b:  start index | end index | subzone name  -----------------------------------    2         |  3        |    y 

in above example, y subzone of x since indexes fall within x's indexes.

the way i'm doing using iterrows go through every row in a, , every row (zone) find slice in b (subzone). solution extremely slow in pandas since iterrows not fast. how can task without using iterrows in pandas?


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

http - Safari render HTML as received -