You can filter out None/null results in Heap by adding a filter that requires the property that you are grouping…