Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Tengo una gráfica que mira las ventas medias diarias de diferentes productos, que hice usando matplotlib. Ahora quiero una segmentación de datos que permita la eliminación de líneas no seleccionadas en el script python. Tengo la segmentación de datos configurada, pero no elimina la línea, pero filtra los datos, que pensé que eliminaría la línea, pero se queda (likley en un estado predeterminado tal vez?).
Aquí hay un snippit de código como referencia.
No tengo el archivo en este momento, pero encontré una solución.
Para que la segmentación de datos funcione en la secuencia de comandos de Python debe haber una referencia a ese archivo. Así que podría haber un ejemplo como este
plt.plot(df['date'], df[f'Product-i'].where(df[f'Product'i'].isin(ProductList))
ProductList es la lista a la que hago referencia en la segmentación de datos, por lo que ahora funciona.
Gracias de nuevo - Encontré la solución leyendo el foro aquí y Prueba y Error
I did 'Fix' this by just realizing something about how Python and Power Bi work together.
When you use a slicer it will filter the column you are plotting. There is no need to 'define' a slicer in the python script
First let me say that its a specific way of thinking one needs to approach this combo. In my way of thinking 'you' as the programmer define the behaviour of the slicer by making a connection between the slicer and the python script. This is wrong. Power Bi, when you add a slicer, will filter the data and run the python script again with the new data filtered data frame. So for me I needed to remove some of the programmers thinking and allow Power Bi to do the thing it does best, simplify a lot of tasks.
It isn't a 'programming' solution or software solution - its a 'Aha, thats smart' light bulb monent solution.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |