Lista de rendimiento de intersecciónAquí está un
Pregunta para todos ustedes magos JSL.
Tengo texto
Datos que necesito agrupar de diferentes maneras.
style = "">
Mi mesa se ve así:
style = "font-weight: bold; text-decoration: underline; font-family: monospace;"> My
Categoría de valor 1
Categoría 2 Categoría 3
style = "font-family: monospace;">
Automóvil club británico
1
1
0
style = "font-family: monospace;">
cama y desayuno
0
1
0
style = "font-family: monospace;">
CC
1
0
0
style = "font-family: monospace;">
DD
0
1
0
style = "font-family: monospace;">
EE
1
0
0
style = "font-family: monospace;">
FF
0
0
0
style = "font-family: monospace;">
Automóvil club británico
1
1
0
style = "font-family: monospace;">
cama y desayuno
0
1
0
style = "font-family: monospace;">
GG
0
0
0
style = "font-family: monospace;">
S.S
0
0
1
style = "font-family: monospace;">
MM
0
1
1
La categoría
Las columnas me permiten agrupar los datos de diferentes maneras.
style = ""> los
Las categorías para este ejemplo provienen de la
siguientes listas:
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> Categoría
1
style = "font-size: 10pt; font-family:" Courier New "; color: navy;"> =
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
{
style = "font-size: 10pt; font-family:" Courier New "; color: púrpura;"> "AA"
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: púrpura;"> "CC"
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: púrpura;"> "EE"
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">}
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">;
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> Categoría
2
style = "font-size: 10pt; font-family:" Courier New "; color: navy;"> =
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
{
style = "font-size: 10pt; font-family:" Courier New "; color: púrpura;"> "AA"
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: púrpura;"> "BB"
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: púrpura;"> "DD"
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: púrpura;"> "MM"
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">}
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">;
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; line-height: 115%; font-family:" Courier New "; color: negro;"> Categoría
3
style = "font-size: 10pt; line-height: 115%; font-family:" Courier New "; color: navy;"> =
style = "font-size: 10pt; line-height: 115%; font-family:" Courier New "; color: negro;">
{
style = "font-size: 10pt; line-height: 115%; font-family:" Courier New "; color: púrpura;"> "KK"
style = "font-size: 10pt; line-height: 115%; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; line-height: 115%; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; line-height: 115%; font-family:" Courier New "; color: púrpura;"> "MM"
style = "font-size: 10pt; line-height: 115%; font-family:" Courier New "; color: negro;">}
style = "font-size: 10pt; line-height: 115%; font-family:" Courier New "; color: navy;">;
Si eres
preguntándome por qué no solo agrego una columna de categoría,
es porque puede haber
se superponen en las listas de categorias.
Asi yo
Necesitará una columna separada para cada categoría.
Si un valor
en el MyValue
columna coincide con una
valor en una lista de categorías, entonces la columna de categoría es 1, de lo contrario
es 0
Esto me permite realizar rápidamente análisis separados de los datos.
emparejando cada categoria
Mi problema
Es uno de los resultados al calcular las columnas de categoría.
style = ""> Sus
No está mal para mesas pequeñas (10,000 filas, 3
categorías, pequeñas listas de categorías).
style = "">
Sin embargo, se atasca
para conjuntos de datos más grandes (300,000 filas, 200
categorías, listas de categorías grandes).
style = ""> Algunos
Las listas de categorías pueden ser bastante grandes (2000 valores).
Basicamente yo
necesita una forma rápida de hacer algún tipo de intersección de lista entre los datos
en el MyValue
columna y los datos en cada
Lista de categoría.
Esta es una muy simple
Ejemplo pero ilustra el concepto.
Aquí esta la
Lógica que estoy usando para una categoría.
style = ""> los
capacidad de encontrar coincidencias entre una lista y una columna usando
style = ""> SELECCIONE DONDE
es muy poderoso
Si puede ser acelerado de alguna manera
¡Me encantaría saber cómo!
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> one_category
style = "font-size: 10pt; font-family:" Courier New "; color: navy;"> =
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: púrpura;"> "Categoría
1 "
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">;
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> category_list
style = "font-size: 10pt; font-family:" Courier New "; color: navy;"> =
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
{
style = "font-size: 10pt; font-family:" Courier New "; color: púrpura;"> "AA"
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: púrpura;"> "CC"
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: púrpura;"> "EE"
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">}
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> nr
style = "font-size: 10pt; font-family:" Courier New "; color: navy;"> =
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: rgb (0, 0, 221);"> nrows
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> (
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> dt )
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">;
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> col_zeroes
style = "font-size: 10pt; font-family:" Courier New "; color: navy;"> =
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: rgb (0, 0, 221);"> j
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> (
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> nr
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: teal;"> 1
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: teal;"> 0
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">)
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">;
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: verde;"> //
Añadir la columna de categoría
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> dt
style = "font-size: 10pt; font-family:" Courier New "; color: navy;"> <<
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: rgb (0, 0, 221);"> new
columna
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> (
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> one_category
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
numérico )
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">;
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: rgb (0, 0, 221);"> column
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> (
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> dt
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
una_categoría )
style = "font-size: 10pt; font-family:" Courier New "; color: navy;"> <<
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
esconder (
style = "font-size: 10pt; font-family:" Courier New "; color: teal;"> 1
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">)
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">;
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: verde;"> //
Establecer la columna entera para ser
ceros inicialmente
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: rgb (0, 0, 221);"> column
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> (
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> dt
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
una_categoría )
style = "font-size: 10pt; font-family:" Courier New "; color: navy;"> <<
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
valores ( col_zeroes El
style = "font-size: 10pt; font-family:" Courier New "; color: teal;"> 0
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: teal;"> 1
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">])
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">;
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: verde;"> //
Seleccionar todas las filas con valores.
emparejando esta categoría
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> dt
style = "font-size: 10pt; font-family:" Courier New "; color: navy;"> <<
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
selecciona donde (
style = "font-size: 10pt; font-family:" Courier New "; color: rgb (0, 0, 221);"> contiene
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> (
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> category_list
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">:
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> Mi
Valor ))
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">;
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: verde;"> //
Obtener una lista de los seleccionados
filas
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> one_cat_rows
style = "font-size: 10pt; font-family:" Courier New "; color: navy;"> =
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
dt
style = "font-size: 10pt; font-family:" Courier New "; color: navy;"> <<
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
ser seleccionado
filas ()
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">;
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: verde;"> //
Establecer todas las filas coincidentes en 1 para
esta categoria
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: rgb (0, 0, 221);"> if
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
(
style = "font-size: 10pt; font-family:" Courier New "; color: rgb (0, 0, 221);"> nrows
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> (
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> one_cat_rows )
style = "font-size: 10pt; font-family:" Courier New "; color: navy;" >>
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: teal;"> 0
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "">
style = "font-size: 10pt; font-family:" Courier New "; color: rgb (0, 0, 221);"> column
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> (
style = "font-size: 10pt; font-family:" Courier New "; color: negro;"> dt
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">,
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
una_categoría ) [ one_cat_rows ]
style = "font-size: 10pt; font-family:" Courier New "; color: navy;"> =
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; font-family:" Courier New "; color: teal;"> 1
style = "font-size: 10pt; font-family:" Courier New "; color: navy;">;
style = "font-size: 10pt; font-family:" Courier New "; color: negro;">
style = "font-size: 10pt; line-height: 115%; font-family:" Courier New "; color: negro;">)
style = "font-size: 10pt; line-height: 115%; font-family:" Courier New "; color: navy;">;