Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
This is a basic python headmap script visual in Power BI.
I am looking to apply a filter to this python script code bellow.
How can be this be filter by slicer(dimension) in this correlation Heatmap code? Below is the code I have written.
------
# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:
# dataset = pandas.DataFrame(A_DENO, A_NUM, _Acceptable,_S_ASIS,_A_ASIS, _Offered,_Region)
# dataset = dataset.drop_duplicates()
# Paste or type your script code here:
import pandas as pd # for data analysis
import matplotlib.pyplot as plt
import seaborn as sns
# Compute the correlation matrix
#filter by Region
# HERE NEED TO MAKE DATASET3.['REGION']
###dataset2= dataset.loc[dataset.Region =='North America' ]
corr = dataset2.corr()
##plt.figure(figsize=(17,17))
sns.heatmap(corr,cmap='coolwarm', annot = True, fmt='.5g',linewidth =1.9)
#plt.title("Correlation HeatMap", fontsize = 16)
plt.xlabel("Features", fontsize = 10)
plt.ylabel("Features", fontsize = 10)
plt.show()
------
The dataset contains several columns.
But I took the picture for those I am interest to work in this python script.
_S_ASIS=
DIVIDE( SUM('Cad_KPI'[_Acceptable]), SUM('Cad_KPI'[_Offered]))*100
_A_ASIS
=DIVIDE(DIVIDE( SUM('Cad_KPI'[_A_NUM]), SUM('Cad_KPI'[_A_DENO])), 60)
Sample data in this image.
Solved! Go to Solution.
Hi @perezco ,
Power BI replots the Python visual, whenever a data change occurs. (filtering)
The Python visual always only receives the filtered data.
https://docs.microsoft.com/en-us/power-bi/desktop-python-visuals
Regards,
Marcus
Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
right, @mwegener .... yes I can used the filters section for the Vizulation from the left but I need is to use slicer filter.
example for Bar chart code:
yes, I am aware this demo file brings few records.. But I see that work fine with the filters slicers.
thanks
Hi @perezco ,
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
User | Count |
---|---|
93 | |
84 | |
78 | |
75 | |
66 |
User | Count |
---|---|
115 | |
105 | |
93 | |
65 | |
60 |