Sunday 9 May 2021

get names of columns with missing values in ML

 # Fill in the line below: get names of columns with missing values

cols_with_missing = [col for col in X_train.columns

                     if X_train[col].isnull().any()]

# Fill in the lines below: drop columns in training and validation data

reduced_X_train = X_train.drop(cols_with_missing, axis=1)

reduced_X_valid = X_valid.drop(cols_with_missing, axis=1)

Wednesday 5 May 2021

Filter your visualization report on passing parameter dynamically on power Bi

In the below screenshot, I am filtering my visualization report based on the selected inputs from the parameter drop down box. click to download the dataset

Please import this dataset on your power bi desktop and follow the instruction below.
  • Home->Get Data->Choose Excel->Choose your path->select your excel file
  • Click on Home button then Transform data

  • Home->Manage Parameter
Note : In type, you can choose any data type based on your requirement. In Suggested values, either you can choose Any value, List of Values or Query. Only the difference is -  in Any value, the input parameter will be constant with the user defined inputs. Inside the List of Values- you can pass multiple parameter but also it would be a constant value or a static parameter. Sometime if you want to modify your parameters you can edit and also data may be differ from your dataset, So the parameter it could not filter your dataset if it is not available.
What if we can add the parameters based on the availability of our data that we have in our Segment field. So, the query option is nothing, it is the set of data that we are creating from our exiting dataset from a particular field.

To create any query on your dataset field , please perform the below step.

Choose you dataset on Edit Query mode-> then Chose your Field->Right Click->Add as new query.
Once the query is created you can choose that Query in query option while creating the parameter.
In this case, the user not to be redefine the parameter values if there are any addons in our dataset.
  • select dropdown on your dataset field (Segment on the current data set) and select text filters->Equal 

  • Please click on the ABC as per the above screenshot to select parameter.
  • Apply and close the power query mode
  • Now go to Power BI desktop and transform data
  • Edit Parameter
  • choose your respective parameter (These parameters are coming from our query that we created on dataset "Segment" field)
  • After choosing your parameter value click on apply changes
  • and below is my final visualization based on I selected the parameter.